Changeset 64534 in webkit
- Timestamp:
- Aug 3, 2010 12:36:44 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r64532 r64534 1 2010-08-02 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Chromium DevTools: Get rid of DevTools RPC. 6 7 https://bugs.webkit.org/show_bug.cgi?id=43335 8 9 * bindings/js/ScriptProfiler.h: 10 (WebCore::ScriptProfiler::getProfilerLogLines): 11 * bindings/v8/ScriptProfiler.cpp: 12 (WebCore::ScriptProfiler::getProfilerLogLines): 13 * bindings/v8/ScriptProfiler.h: 14 * inspector/Inspector.idl: 15 * inspector/InspectorBackend.cpp: 16 (WebCore::InspectorBackend::takeHeapSnapshot): 17 (WebCore::InspectorBackend::getProfilerLogLines): 18 * inspector/InspectorBackend.h: 19 * inspector/InspectorController.cpp: 20 (WebCore::InspectorController::disableProfiler): 21 * inspector/InspectorController.h: 22 * inspector/InspectorFrontend.h: 23 * inspector/front-end/InspectorBackendStub.js: 24 (WebInspector.InspectorBackendStub): 25 1 26 2010-08-02 Dan Bernstein <mitz@apple.com> 2 27 -
trunk/WebCore/bindings/js/ScriptProfiler.h
r61411 r64534 41 41 static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); 42 42 static void takeHeapSnapshot() { } 43 static long getProfilerLogLines(long, String*) { return 0; } 43 44 }; 44 45 -
trunk/WebCore/bindings/v8/ScriptProfiler.cpp
r61411 r64534 60 60 } 61 61 62 long ScriptProfiler::getProfilerLogLines(long position, String* data) 63 { 64 static char buffer[65536]; 65 const int readSize = v8::V8::GetLogLines(position, buffer, sizeof(buffer) - 1); 66 buffer[readSize] = '\0'; 67 position += readSize; 68 *data = buffer; 69 return position; 70 } 71 62 72 } // namespace WebCore -
trunk/WebCore/bindings/v8/ScriptProfiler.h
r61411 r64534 45 45 static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); 46 46 static void takeHeapSnapshot(); 47 static long getProfilerLogLines(long position, String* data); 47 48 }; 48 49 -
trunk/WebCore/inspector/Inspector.idl
r63891 r64534 99 99 100 100 void takeHeapSnapshot(); 101 void getProfilerLogLines(in long callId, in long inPosition, out long outPosition, out String log); 101 102 #endif 102 103 void setInjectedScriptSource(in String scriptSource); … … 158 159 void removeDOMStorageItem(in long callId, in long storageId, in String key); 159 160 #endif 161 160 162 }; 161 163 } -
trunk/WebCore/inspector/InspectorBackend.cpp
r63891 r64534 53 53 #include "ScriptArray.h" 54 54 #include "ScriptBreakpoint.h" 55 #include "ScriptProfiler.h" 55 56 #include "SerializedScriptValue.h" 56 57 … … 293 294 void InspectorBackend::takeHeapSnapshot() 294 295 { 295 if (m_inspectorController) 296 m_inspectorController->takeHeapSnapshot(); 296 ScriptProfiler::takeHeapSnapshot(); 297 } 298 299 void InspectorBackend::getProfilerLogLines(long callId, long position) 300 { 301 // FIXME: we should make inspector dispatcher pluggable, so that embedders could contribute APIs instead of polluting the core one 302 // https://bugs.webkit.org/show_bug.cgi?id=43357 303 if (RemoteInspectorFrontend* frontend = remoteFrontend()) { 304 String data; 305 int outPosition = ScriptProfiler::getProfilerLogLines(position, &data); 306 frontend->didGetProfilerLogLines(callId, outPosition, data); 307 } 297 308 } 298 309 #endif -
trunk/WebCore/inspector/InspectorBackend.h
r63891 r64534 113 113 114 114 void takeHeapSnapshot(); 115 void getProfilerLogLines(long callId, long position); 115 116 #endif 116 117 -
trunk/WebCore/inspector/InspectorController.cpp
r64458 r64534 1689 1689 m_frontend->profilerWasDisabled(); 1690 1690 } 1691 1692 void InspectorController::takeHeapSnapshot()1693 {1694 if (!enabled())1695 return;1696 1697 ScriptProfiler::takeHeapSnapshot();1698 }1699 1691 #endif 1700 1692 -
trunk/WebCore/inspector/InspectorController.h
r64142 r64534 261 261 bool profilerEnabled() const { return enabled() && m_profilerEnabled; } 262 262 263 void takeHeapSnapshot();264 265 263 void enableDebugger(); 266 264 void disableDebugger(bool always = false); -
trunk/WebCore/inspector/front-end/InspectorBackendStub.js
r64204 r64534 82 82 this._registerDelegate("storeLastActivePanel"); 83 83 this._registerDelegate("takeHeapSnapshot"); 84 this._registerDelegate("getProfilerLogLines"); 84 85 85 86 this._registerDelegate("getAllStyles"); -
trunk/WebKit/chromium/ChangeLog
r64530 r64534 1 2010-08-02 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Chromium DevTools: Get rid of DevTools RPC. 6 7 https://bugs.webkit.org/show_bug.cgi?id=43335 8 9 * WebKit.gyp: 10 * public/WebDevToolsAgent.h: 11 * public/WebDevToolsAgentClient.h: 12 (WebKit::WebDevToolsAgentClient::sendMessageToInspectorFrontend): 13 (WebKit::WebDevToolsAgentClient::sendDebuggerOutput): 14 (WebKit::WebDevToolsAgentClient::sendDispatchToAPU): 15 * public/WebDevToolsFrontend.h: 16 * public/WebDevToolsFrontendClient.h: 17 (WebKit::WebDevToolsFrontendClient::sendMessageToBackend): 18 * public/WebDevToolsMessageData.h: Removed. 19 * public/WebDevToolsMessageTransport.h: Removed. 20 * src/APUAgentDelegate.h: Removed. 21 * src/DebuggerAgent.h: Removed. 22 * src/DebuggerAgentImpl.cpp: 23 (WebKit::DebuggerAgentImpl::DebuggerAgentImpl): 24 (WebKit::DebuggerAgentImpl::debuggerOutput): 25 * src/DebuggerAgentImpl.h: 26 * src/DebuggerAgentManager.cpp: 27 (WebKit::DebuggerAgentManager::debugDetach): 28 (WebKit::DebuggerAgentManager::onV8DebugMessage): 29 (WebKit::DebuggerAgentManager::executeDebuggerCommand): 30 (WebKit::DebuggerAgentManager::sendCommandToV8): 31 (WebKit::DebuggerAgentManager::sendContinueCommandToV8): 32 * src/DevToolsRPC.h: Removed. 33 * src/DevToolsRPCJS.h: Removed. 34 * src/InspectorClientImpl.cpp: 35 * src/InspectorFrontendClientImpl.cpp: 36 (WebKit::InspectorFrontendClientImpl::sendMessageToBackend): 37 * src/ProfilerAgent.h: Removed. 38 * src/ProfilerAgentImpl.cpp: Removed. 39 * src/ProfilerAgentImpl.h: Removed. 40 * src/ToolsAgent.h: Removed. 41 * src/WebDevToolsAgentImpl.cpp: 42 (WebKit::): 43 (WebKit::WebDevToolsAgentImpl::WebDevToolsAgentImpl): 44 (WebKit::WebDevToolsAgentImpl::attach): 45 (WebKit::WebDevToolsAgentImpl::didClearWindowObject): 46 (WebKit::WebDevToolsAgentImpl::dispatchOnInspectorBackend): 47 (WebKit::WebDevToolsAgentImpl::jsDispatchOnClient): 48 (WebKit::WebDevToolsAgentImpl::sendMessageToFrontend): 49 * src/WebDevToolsAgentImpl.h: 50 * src/WebDevToolsFrontendImpl.cpp: 51 (WebKit::WebDevToolsFrontendImpl::WebDevToolsFrontendImpl): 52 (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): 53 (WebKit::WebDevToolsFrontendImpl::frontendLoaded): 54 (WebKit::WebDevToolsFrontendImpl::executeScript): 55 * src/WebDevToolsFrontendImpl.h: 56 * src/js/DevTools.js: 57 (devtools.dispatch): 58 (devtools.ToolsAgent): 59 * src/js/DevToolsHostStub.js: 60 * src/js/ProfilerAgent.js: 61 (devtools.ProfilerAgent): 62 (devtools.ProfilerAgent.prototype._getNextLogLines.else.delayedRequest): 63 (devtools.ProfilerAgent.prototype._getNextLogLines): 64 (devtools.ProfilerAgent.prototype._didGetProfilerLogLines): 65 * src/js/ProfilerProcessor.js: 66 (devtools.profiler.Processor.prototype.printError): 67 1 68 2010-08-02 Kent Tamura <tkent@chromium.org> 2 69 -
trunk/WebKit/chromium/WebKit.gyp
r64463 r64534 143 143 'public/WebDevToolsFrontend.h', 144 144 'public/WebDevToolsFrontendClient.h', 145 'public/WebDevToolsMessageData.h',146 'public/WebDevToolsMessageTransport.h',147 145 'public/WebDocument.h', 148 146 'public/WebDocumentType.h', … … 272 270 'public/win/WebScreenInfoFactory.h', 273 271 'public/win/WebScreenInfoFactory.h', 274 'src/APUAgentDelegate.h',275 272 'src/ApplicationCacheHost.cpp', 276 273 'src/ApplicationCacheHostInternal.h', … … 293 290 'src/ContextMenuClientImpl.h', 294 291 'src/DatabaseObserver.cpp', 295 'src/DebuggerAgent.h',296 292 'src/DebuggerAgentImpl.cpp', 297 293 'src/DebuggerAgentImpl.h', 298 294 'src/DebuggerAgentManager.cpp', 299 295 'src/DebuggerAgentManager.h', 300 'src/DevToolsRPC.h',301 'src/DevToolsRPCJS.h',302 296 'src/DOMUtilitiesPrivate.cpp', 303 297 'src/DOMUtilitiesPrivate.h', … … 344 338 'src/PlatformMessagePortChannel.cpp', 345 339 'src/PlatformMessagePortChannel.h', 346 'src/ProfilerAgent.h',347 'src/ProfilerAgentImpl.cpp',348 'src/ProfilerAgentImpl.h',349 340 'src/ResourceHandle.cpp', 350 341 'src/SharedWorkerRepository.cpp', … … 360 351 'src/StorageNamespaceProxy.h', 361 352 'src/TemporaryGlue.h', 362 'src/ToolsAgent.h',363 353 'src/WebAccessibilityCache.cpp', 364 354 'src/WebAccessibilityCacheImpl.cpp', -
trunk/WebKit/chromium/public/WebDevToolsAgent.h
r62927 r64534 55 55 virtual void didNavigate() = 0; 56 56 57 virtual void dispatch MessageFromFrontend(const WebDevToolsMessageData&) = 0;57 virtual void dispatchOnInspectorBackend(const WebString& message) = 0; 58 58 59 59 virtual void inspectElementAt(const WebPoint&) = 0; … … 72 72 // Asynchronously request debugger to pause immediately. 73 73 WEBKIT_API static void debuggerPauseScript(); 74 75 WEBKIT_API static bool dispatchMessageFromFrontendOnIOThread(WebDevToolsMessageTransport*, const WebDevToolsMessageData&);76 74 77 75 typedef void (*MessageLoopDispatchHandler)(); -
trunk/WebKit/chromium/public/WebDevToolsAgentClient.h
r61616 r64534 41 41 class WebDevToolsAgentClient { 42 42 public: 43 virtual void sendMessageToFrontend(const WebDevToolsMessageData&) { } 43 virtual void sendMessageToInspectorFrontend(const WebString&) { } 44 virtual void sendDebuggerOutput(const WebString&) { } 45 virtual void sendDispatchToAPU(const WebString&) { } 44 46 45 47 // Invalidates widget which leads to the repaint. -
trunk/WebKit/chromium/public/WebDevToolsFrontend.h
r51984 r64534 39 39 class WebString; 40 40 class WebView; 41 struct WebDevToolsMessageData;42 41 43 42 // WebDevToolsFrontend represents DevTools client sitting in the Glue. It provides … … 51 50 virtual ~WebDevToolsFrontend() {} 52 51 53 virtual void dispatch MessageFromAgent(const WebDevToolsMessageData&) = 0;52 virtual void dispatchOnInspectorFrontend(const WebString&) = 0; 54 53 }; 55 54 -
trunk/WebKit/chromium/public/WebDevToolsFrontendClient.h
r60436 r64534 41 41 WebDevToolsFrontendClient() { } 42 42 43 virtual void sendMessageTo Agent(const WebDevToolsMessageData&) { }43 virtual void sendMessageToBackend(const WebString&) { } 44 44 virtual void sendDebuggerCommandToAgent(const WebString& command) { } 45 45 virtual void sendDebuggerPauseScript() { } -
trunk/WebKit/chromium/src/DebuggerAgentImpl.cpp
r60893 r64534 38 38 #include "ScriptDebugServer.h" 39 39 #include "V8Binding.h" 40 #include "WebDevToolsAgentClient.h" 40 41 #include "WebDevToolsAgentImpl.h" 41 42 #include "WebViewImpl.h" … … 54 55 DebuggerAgentImpl::DebuggerAgentImpl( 55 56 WebViewImpl* webViewImpl, 56 DebuggerAgentDelegate* delegate,57 WebDevToolsAgent Impl* webdevtoolsAgent)57 WebDevToolsAgentImpl* webdevtoolsAgent, 58 WebDevToolsAgentClient* webdevtoolsAgentClient) 58 59 : m_webViewImpl(webViewImpl) 59 , m_delegate(delegate)60 60 , m_webdevtoolsAgent(webdevtoolsAgent) 61 , m_webdevtoolsAgentClient(webdevtoolsAgentClient) 61 62 , m_autoContinueOnException(false) 62 63 { … … 69 70 } 70 71 71 void DebuggerAgentImpl::getContextId()72 {73 m_delegate->setContextId(m_webdevtoolsAgent->hostId());74 }75 76 void DebuggerAgentImpl::processDebugCommands()77 {78 DebuggerAgentManager::UtilityContextScope utilityScope;79 v8::Debug::ProcessDebugMessages();80 }81 82 72 void DebuggerAgentImpl::debuggerOutput(const String& command) 83 73 { 84 m_ delegate->debuggerOutput(command);74 m_webdevtoolsAgentClient->sendDebuggerOutput(command); 85 75 m_webdevtoolsAgent->forceRepaint(); 86 76 } -
trunk/WebKit/chromium/src/DebuggerAgentImpl.h
r60893 r64534 32 32 #define DebuggerAgentImpl_h 33 33 34 #include "DebuggerAgent.h"35 36 34 #include <v8.h> 37 35 #include <wtf/HashSet.h> … … 48 46 namespace WebKit { 49 47 48 class WebDevToolsAgentClient; 50 49 class WebDevToolsAgentImpl; 51 50 class WebViewImpl; 52 51 53 class DebuggerAgentImpl : public DebuggerAgent{52 class DebuggerAgentImpl { 54 53 public: 55 54 DebuggerAgentImpl(WebKit::WebViewImpl* webViewImpl, 56 DebuggerAgentDelegate* delegate,57 WebDevToolsAgent Impl* webdevtoolsAgent);55 WebDevToolsAgentImpl* webdevtoolsAgent, 56 WebDevToolsAgentClient* webdevtoolsAgentClient); 58 57 virtual ~DebuggerAgentImpl(); 59 60 // DebuggerAgent implementation.61 virtual void getContextId();62 virtual void processDebugCommands();63 58 64 59 void debuggerOutput(const WebCore::String& out); … … 88 83 private: 89 84 WebKit::WebViewImpl* m_webViewImpl; 90 DebuggerAgentDelegate* m_delegate;91 85 WebDevToolsAgentImpl* m_webdevtoolsAgent; 86 WebDevToolsAgentClient* m_webdevtoolsAgentClient; 92 87 bool m_autoContinueOnException; 93 88 }; -
trunk/WebKit/chromium/src/DebuggerAgentManager.cpp
r63311 r64534 158 158 } else { 159 159 // Remove all breakpoints set by the agent. 160 String clearBreakpointGroupCmd =String::format(160 WebCore::String clearBreakpointGroupCmd = WebCore::String::format( 161 161 "{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\"," 162 162 "\"arguments\":{\"groupId\":%d}}", … … 177 177 v8::HandleScope scope; 178 178 v8::String::Value value(message.GetJSON()); 179 String out(reinterpret_cast<const UChar*>(*value), value.length());179 WebCore::String out(reinterpret_cast<const UChar*>(*value), value.length()); 180 180 181 181 // If callerData is not 0 the message is a response to a debugger command. … … 249 249 } 250 250 251 void DebuggerAgentManager::executeDebuggerCommand(const String& command, int callerId)251 void DebuggerAgentManager::executeDebuggerCommand(const WebCore::String& command, int callerId) 252 252 { 253 253 sendCommandToV8(command, new CallerIdWrapper(callerId)); … … 287 287 } 288 288 289 void DebuggerAgentManager::sendCommandToV8(const String& cmd, v8::Debug::ClientData* data)289 void DebuggerAgentManager::sendCommandToV8(const WebCore::String& cmd, v8::Debug::ClientData* data) 290 290 { 291 291 v8::Debug::SendCommand(reinterpret_cast<const uint16_t*>(cmd.characters()), cmd.length(), data); … … 294 294 void DebuggerAgentManager::sendContinueCommandToV8() 295 295 { 296 String continueCmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}");296 WebCore::String continueCmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}"); 297 297 sendCommandToV8(continueCmd, new CallerIdWrapper()); 298 298 } -
trunk/WebKit/chromium/src/InspectorClientImpl.cpp
r61772 r64534 37 37 #include "Page.h" 38 38 #include "WebDevToolsAgentImpl.h" 39 #include "WebDevToolsMessageData.h"40 39 #include "WebRect.h" 41 40 #include "WebURL.h" -
trunk/WebKit/chromium/src/InspectorFrontendClientImpl.cpp
r64124 r64534 41 41 #include "WebDevToolsFrontendClient.h" 42 42 #include "WebDevToolsFrontendImpl.h" 43 #include "WebString.h" 43 44 44 45 using namespace WebCore; … … 127 128 void InspectorFrontendClientImpl::sendMessageToBackend(const String& message) 128 129 { 129 WebDevToolsMessageData messageData; 130 messageData.className = "ToolsAgent"; 131 messageData.methodName = "dispatchOnInspectorController"; 132 WebVector<WebString> args(static_cast<size_t>(1)); 133 args[0] = message; 134 messageData.arguments.swap(args); 135 m_client->sendMessageToAgent(messageData); 130 m_client->sendMessageToBackend(message); 136 131 } 137 132 -
trunk/WebKit/chromium/src/WebDevToolsAgentImpl.cpp
r64124 r64534 47 47 #include "PageGroup.h" 48 48 #include "PlatformString.h" 49 #include "ProfilerAgentImpl.h"50 49 #include "ResourceError.h" 51 50 #include "ResourceRequest.h" … … 60 59 #include "WebDataSource.h" 61 60 #include "WebDevToolsAgentClient.h" 62 #include "WebDevToolsMessageData.h"63 #include "WebDevToolsMessageTransport.h"64 61 #include "WebFrameImpl.h" 65 62 #include "WebRect.h" … … 110 107 static const char kApuAgentFeatureName[] = "apu-agent"; 111 108 112 class IORPCDelegate : public DevToolsRPC::Delegate, public Noncopyable {113 public:114 IORPCDelegate() : m_transport(0) { }115 explicit IORPCDelegate(WebDevToolsMessageTransport* transport) : m_transport(transport) { }116 virtual ~IORPCDelegate() { }117 virtual void sendRpcMessage(const WebDevToolsMessageData& data)118 {119 if (m_transport)120 m_transport->sendMessageToFrontendOnIOThread(data);121 }122 123 private:124 WebDevToolsMessageTransport* m_transport;125 };126 127 109 class ClientMessageLoopAdapter : public WebCore::ScriptDebugServer::ClientMessageLoop { 128 110 public: … … 223 205 DebuggerAgentManager::setExposeV8DebuggerProtocol( 224 206 client->exposeV8DebuggerProtocol()); 225 m_debuggerAgentDelegateStub.set(new DebuggerAgentDelegateStub(this));226 m_toolsAgentDelegateStub.set(new ToolsAgentDelegateStub(this));227 m_apuAgentDelegateStub.set(new ApuAgentDelegateStub(this));228 207 } 229 208 … … 252 231 253 232 m_debuggerAgentImpl.set( 254 new DebuggerAgentImpl(m_webViewImpl, 255 m_debuggerAgentDelegateStub.get(), 256 this)); 233 new DebuggerAgentImpl(m_webViewImpl, this, m_client)); 257 234 createInspectorFrontendProxy(); 258 235 … … 297 274 { 298 275 DebuggerAgentManager::setHostId(webframe, m_hostId); 299 if (m_attached) {300 // Push context id into the client if it is already attached.301 m_debuggerAgentDelegateStub->setContextId(m_hostId);302 }303 276 } 304 277 … … 308 281 } 309 282 310 void WebDevToolsAgentImpl::dispatchOnInspector Controller(constString& message)283 void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message) 311 284 { 312 285 inspectorController()->inspectorBackendDispatcher()->dispatch(message); 313 }314 315 void WebDevToolsAgentImpl::dispatchMessageFromFrontend(const WebDevToolsMessageData& data)316 {317 if (ToolsAgentDispatch::dispatch(this, data))318 return;319 320 if (!m_attached)321 return;322 323 if (m_debuggerAgentImpl.get() && DebuggerAgentDispatch::dispatch(m_debuggerAgentImpl.get(), data))324 return;325 286 } 326 287 … … 343 304 ic->disableResourceTracking(false /* not sticky */); 344 305 } 345 }346 347 void WebDevToolsAgentImpl::sendRpcMessage(const WebDevToolsMessageData& data)348 {349 m_client->sendMessageToFrontend(data);350 306 } 351 307 … … 429 385 430 386 if (!agent->m_apuAgentEnabled) { 431 agent->m_ toolsAgentDelegateStub->dispatchOnClient(message);387 agent->m_client->sendMessageToInspectorFrontend(message); 432 388 return v8::Undefined(); 433 389 } … … 437 393 return v8::Undefined(); 438 394 439 if (method != " addRecordToTimeline" && method != "updateResource" && method != "addResource")395 if (method != "updateResource" && method != "addResource") 440 396 return v8::Undefined(); 441 397 442 agent->m_ apuAgentDelegateStub->dispatchToApu(message);398 agent->m_client->sendDispatchToAPU(message); 443 399 return v8::Undefined(); 444 400 } … … 544 500 return false; 545 501 546 if (devToolsAgent->m_apuAgentEnabled && devToolsAgent->m_apuAgentDelegateStub) {547 devToolsAgent->m_apuAgentDelegateStub->dispatchToApu(message);502 if (devToolsAgent->m_apuAgentEnabled) { 503 m_client->sendDispatchToAPU(message); 548 504 return true; 549 505 } 550 506 551 WebVector<WebString> arguments(size_t(1)); 552 arguments[0] = message; 553 WebDevToolsMessageData data; 554 data.className = "ToolsAgentDelegate"; 555 data.methodName = "dispatchOnClient"; 556 data.arguments.swap(arguments); 557 devToolsAgent->sendRpcMessage(data); 507 m_client->sendMessageToInspectorFrontend(message); 558 508 return true; 559 509 } … … 609 559 } 610 560 611 bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(WebDevToolsMessageTransport* transport, const WebDevToolsMessageData& data)612 {613 IORPCDelegate delegate(transport);614 ProfilerAgentDelegateStub stub(&delegate);615 ProfilerAgentImpl agent(&stub);616 return ProfilerAgentDispatch::dispatch(&agent, data);617 }618 619 561 } // namespace WebKit -
trunk/WebKit/chromium/src/WebDevToolsAgentImpl.h
r64124 r64534 34 34 #include "InspectorClient.h" 35 35 36 #include "APUAgentDelegate.h"37 #include "DevToolsRPC.h"38 #include "ToolsAgent.h"39 36 #include "WebDevToolsAgentPrivate.h" 40 37 … … 52 49 namespace WebKit { 53 50 54 class DebuggerAgentDelegateStub;55 51 class DebuggerAgentImpl; 56 52 class WebDevToolsAgentClient; … … 65 61 66 62 class WebDevToolsAgentImpl : public WebDevToolsAgentPrivate, 67 public ToolsAgent,68 public DevToolsRPC::Delegate,69 63 public WebCore::InspectorClient { 70 64 public: 71 65 WebDevToolsAgentImpl(WebViewImpl* webViewImpl, WebDevToolsAgentClient* client); 72 66 virtual ~WebDevToolsAgentImpl(); 73 74 // ToolsAgent implementation.75 virtual void dispatchOnInspectorController(const WebCore::String& message);76 67 77 68 // WebDevToolsAgentPrivate implementation. … … 82 73 virtual void detach(); 83 74 virtual void didNavigate(); 84 virtual void dispatch MessageFromFrontend(const WebDevToolsMessageData& data);75 virtual void dispatchOnInspectorBackend(const WebString& message); 85 76 virtual void inspectElementAt(const WebPoint& point); 86 77 virtual void evaluateInWebInspector(long callId, const WebString& script); … … 108 99 virtual bool sendMessageToFrontend(const WebCore::String&); 109 100 110 // DevToolsRPC::Delegate implementation.111 virtual void sendRpcMessage(const WebDevToolsMessageData& data);112 113 101 void forceRepaint(); 114 102 … … 131 119 WebDevToolsAgentClient* m_client; 132 120 WebViewImpl* m_webViewImpl; 133 OwnPtr<DebuggerAgentDelegateStub> m_debuggerAgentDelegateStub;134 OwnPtr<ToolsAgentDelegateStub> m_toolsAgentDelegateStub;135 121 OwnPtr<DebuggerAgentImpl> m_debuggerAgentImpl; 136 OwnPtr<ApuAgentDelegateStub> m_apuAgentDelegateStub;137 122 bool m_apuAgentEnabled; 138 123 bool m_resourceTrackingWasEnabled; -
trunk/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp
r63896 r64534 36 36 #include "ContextMenuItem.h" 37 37 #include "DOMWindow.h" 38 #include "DebuggerAgent.h"39 #include "DevToolsRPCJS.h"40 38 #include "Document.h" 41 39 #include "Event.h" … … 49 47 #include "Pasteboard.h" 50 48 #include "PlatformString.h" 51 #include "ProfilerAgent.h"52 49 #include "SecurityOrigin.h" 53 50 #include "Settings.h" 54 #include "ToolsAgent.h"55 51 #include "V8Binding.h" 56 52 #include "V8DOMWrapper.h" … … 78 74 return v8::String::New(reinterpret_cast<const uint16_t*>(s.characters()), s.length()); 79 75 } 80 81 DEFINE_RPC_JS_BOUND_OBJ(DebuggerAgent, DEBUGGER_AGENT_STRUCT, DebuggerAgentDelegate, DEBUGGER_AGENT_DELEGATE_STRUCT)82 DEFINE_RPC_JS_BOUND_OBJ(ProfilerAgent, PROFILER_AGENT_STRUCT, ProfilerAgentDelegate, PROFILER_AGENT_DELEGATE_STRUCT)83 DEFINE_RPC_JS_BOUND_OBJ(ToolsAgent, TOOLS_AGENT_STRUCT, ToolsAgentDelegate, TOOLS_AGENT_DELEGATE_STRUCT)84 76 85 77 WebDevToolsFrontend* WebDevToolsFrontend::create( … … 114 106 v8::Handle<v8::Context> frameContext = V8Proxy::context(frame->frame()); 115 107 116 m_debuggerAgentObj.set(new JSDebuggerAgentBoundObj(this, frameContext, "RemoteDebuggerAgent"));117 m_profilerAgentObj.set(new JSProfilerAgentBoundObj(this, frameContext, "RemoteProfilerAgent"));118 m_toolsAgentObj.set(new JSToolsAgentBoundObj(this, frameContext, "RemoteToolsAgent"));119 120 108 // Debugger commands should be sent using special method. 121 109 BoundObject debuggerCommandExecutorObj(frameContext, this, "RemoteDebuggerCommandExecutor"); 122 debuggerCommandExecutorObj.addProtoFunction(123 "DebuggerCommand",124 WebDevToolsFrontendImpl::jsDebuggerCommand);125 110 debuggerCommandExecutorObj.addProtoFunction( 126 111 "DebuggerPauseScript", … … 133 118 } 134 119 135 void WebDevToolsFrontendImpl::dispatch MessageFromAgent(const WebDevToolsMessageData& data)120 void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& message) 136 121 { 137 Vector<String> v;138 v.append(data.className);139 v.append(data.methodName);140 for (size_t i = 0; i < data.arguments.size(); i++)141 v.append(data.arguments[i]);142 122 if (!m_loaded) { 143 m_pendingIncomingMessages.append( v);123 m_pendingIncomingMessages.append(message); 144 124 return; 145 125 } 146 executeScript( v);126 executeScript(message); 147 127 } 148 128 … … 151 131 m_loaded = true; 152 132 153 for (Vector< Vector<String>>::iterator it = m_pendingIncomingMessages.begin();133 for (Vector<WebString>::iterator it = m_pendingIncomingMessages.begin(); 154 134 it != m_pendingIncomingMessages.end(); 155 135 ++it) { … … 159 139 } 160 140 161 void WebDevToolsFrontendImpl::executeScript(const Vector<String>& v)141 void WebDevToolsFrontendImpl::executeScript(const WebString& message) 162 142 { 163 143 WebFrameImpl* frame = m_webViewImpl->mainFrameImpl(); … … 169 149 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(dispatchFunction); 170 150 Vector< v8::Handle<v8::Value> > args; 171 for (size_t i = 0; i < v.size(); i++) 172 args.append(ToV8String(v.at(i))); 151 args.append(ToV8String(message)); 173 152 v8::TryCatch tryCatch; 174 153 tryCatch.SetVerbose(true); 175 154 function->Call(frameContext->Global(), args.size(), args.data()); 176 }177 178 void WebDevToolsFrontendImpl::sendRpcMessage(const WebDevToolsMessageData& data)179 {180 m_client->sendMessageToAgent(data);181 }182 183 v8::Handle<v8::Value> WebDevToolsFrontendImpl::jsDebuggerCommand(const v8::Arguments& args)184 {185 WebDevToolsFrontendImpl* frontend = static_cast<WebDevToolsFrontendImpl*>(v8::External::Cast(*args.Data())->Value());186 WebString command = WebCore::toWebCoreStringWithNullCheck(args[0]);187 frontend->m_client->sendDebuggerCommandToAgent(command);188 return v8::Undefined();189 155 } 190 156 -
trunk/WebKit/chromium/src/WebDevToolsFrontendImpl.h
r56999 r64534 32 32 #define WebDevToolsFrontendImpl_h 33 33 34 #include " DevToolsRPC.h"34 #include "PlatformString.h" 35 35 #include "WebDevToolsFrontend.h" 36 36 #include <v8.h> … … 50 50 namespace WebKit { 51 51 52 class JSDebuggerAgentBoundObj;53 class JSProfilerAgentBoundObj;54 class JSToolsAgentBoundObj;55 52 class WebDevToolsClientDelegate; 56 53 class WebViewImpl; 57 54 struct WebDevToolsMessageData; 58 55 56 using WebCore::String; 57 59 58 class WebDevToolsFrontendImpl : public WebKit::WebDevToolsFrontend 60 , public DevToolsRPC::Delegate61 59 , public Noncopyable { 62 60 public: … … 67 65 virtual ~WebDevToolsFrontendImpl(); 68 66 69 // DevToolsRPC::Delegate implementation.70 virtual void sendRpcMessage(const WebKit::WebDevToolsMessageData& data);71 72 67 // WebDevToolsFrontend implementation. 73 virtual void dispatch MessageFromAgent(const WebKit::WebDevToolsMessageData& data);68 virtual void dispatchOnInspectorFrontend(const WebString& message); 74 69 75 70 void frontendLoaded(); 76 71 77 72 private: 78 void executeScript(const Vector<String>& v);73 void executeScript(const WebString& message); 79 74 80 static v8::Handle<v8::Value> jsDebuggerCommand(const v8::Arguments& args);81 75 static v8::Handle<v8::Value> jsDebuggerPauseScript(const v8::Arguments& args); 82 76 … … 84 78 WebKit::WebDevToolsFrontendClient* m_client; 85 79 String m_applicationLocale; 86 OwnPtr<JSDebuggerAgentBoundObj> m_debuggerAgentObj;87 OwnPtr<JSProfilerAgentBoundObj> m_profilerAgentObj;88 OwnPtr<JSToolsAgentBoundObj> m_toolsAgentObj;89 80 bool m_loaded; 90 Vector< Vector<String>> m_pendingIncomingMessages;81 Vector<WebString> m_pendingIncomingMessages; 91 82 }; 92 83 -
trunk/WebKit/chromium/src/js/DevTools.js
r64265 r64534 42 42 * @param {string} param1, param2, param3 Arguments to dispatch. 43 43 */ 44 devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) 45 { 46 remoteName = "Remote" + remoteName.substring(0, remoteName.length - 8); 47 var agent = window[remoteName]; 48 if (!agent) { 49 debugPrint("No remote agent '" + remoteName + "' found."); 50 return; 51 } 52 var method = agent[methodName]; 53 if (!method) { 54 debugPrint("No method '" + remoteName + "." + methodName + "' found."); 55 return; 56 } 57 method.call(this, param1, param2, param3); 58 }; 59 60 61 devtools.ToolsAgent = function() 62 { 63 RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback; 64 RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this); 65 this.profilerAgent_ = new devtools.ProfilerAgent(); 66 }; 67 68 69 /** 70 * @param {string} script Script exression to be evaluated in the context of the 71 * inspected page. 72 * @param {function(Object|string, boolean):undefined} opt_callback Function to 73 * call with the result. 74 */ 75 devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, opt_callback) 76 { 77 InspectorBackend.evaluate(script, opt_callback || function() {}); 78 }; 79 80 81 /** 82 * @return {devtools.ProfilerAgent} Profiler agent instance. 83 */ 84 devtools.ToolsAgent.prototype.getProfilerAgent = function() 85 { 86 return this.profilerAgent_; 87 }; 88 89 90 /** 91 * @param {string} message Serialized call to be dispatched on WebInspector. 92 * @private 93 */ 94 devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message) 44 devtools$$dispatch = function(message) 95 45 { 96 46 var args = typeof message === "string" ? JSON.parse(message) : message; … … 101 51 102 52 103 /** 104 * Evaluates js expression. 105 * @param {string} expr 106 */ 107 devtools.ToolsAgent.prototype.evaluate = function(expr) 108 { 109 RemoteToolsAgent.evaluate(expr); 110 }; 111 112 113 /** 114 * Prints string to the inspector console or shows alert if the console doesn't 115 * exist. 116 * @param {string} text 117 */ 118 function debugPrint(text) { 119 WebInspector.log(text); 120 } 53 devtools.ToolsAgent = function() 54 { 55 this.profilerAgent_ = new devtools.ProfilerAgent(); 56 }; 57 58 59 /** 60 * @return {devtools.ProfilerAgent} Profiler agent instance. 61 */ 62 devtools.ToolsAgent.prototype.getProfilerAgent = function() 63 { 64 return this.profilerAgent_; 65 }; 66 121 67 122 68 -
trunk/WebKit/chromium/src/js/DevToolsHostStub.js
r63965 r64534 36 36 if (!window["RemoteDebuggerCommandExecutor"]) { 37 37 window["RemoteDebuggerCommandExecutor"] = {}; 38 window["RemoteProfilerAgent"] = {};39 window["RemoteToolsAgent"] = {40 dispatchOnInspectorController: function() {}41 };42 38 } -
trunk/WebKit/chromium/src/js/ProfilerAgent.js
r61411 r64534 38 38 devtools.ProfilerAgent = function() 39 39 { 40 RemoteProfilerAgent.didGetActiveProfilerModules = this._didGetActiveProfilerModules.bind(this);41 RemoteProfilerAgent.didGetLogLines = this._didGetLogLines.bind(this);42 40 43 41 /** … … 93 91 return; 94 92 var pos = this._lastRequestedLogPosition = this._logPosition; 93 94 var callId = WebInspector.Callback.wrap(this._didGetProfilerLogLines.bind(this)); 95 95 if (immediately) 96 RemoteProfilerAgent.getLogLines(pos); 97 else 98 setTimeout(function() { RemoteProfilerAgent.getLogLines(pos); }, 500); 96 InspectorBackend.getProfilerLogLines(callId, pos); 97 else { 98 function delayedRequest() 99 { 100 InspectorBackend.getProfilerLogLines(callId, pos); 101 } 102 setTimeout(delayedRequest, 500); 103 } 99 104 }; 100 105 … … 115 120 116 121 /** 117 * Handles current profiler status.118 * @param {number} modules List of active (started) modules.119 */120 devtools.ProfilerAgent.prototype._didGetActiveProfilerModules = function(modules)121 {122 };123 124 125 /**126 122 * Handles a portion of a profiler log retrieved by getLogLines call. 127 123 * @param {number} pos Current position in log. 128 124 * @param {string} log A portion of profiler log. 129 125 */ 130 devtools.ProfilerAgent.prototype._didGet LogLines = function(pos, log)126 devtools.ProfilerAgent.prototype._didGetProfilerLogLines = function(pos, log) 131 127 { 132 128 this._logPosition = pos; … … 139 135 } 140 136 }; 137 138 WebInspector.didGetProfilerLogLines = WebInspector.Callback.processCallback; -
trunk/WebKit/chromium/src/js/ProfilerProcessor.js
r54547 r64534 282 282 devtools.profiler.Processor.prototype.printError = function(str) 283 283 { 284 debugPrint(str);284 WebInspector.log(str); 285 285 }; 286 286 -
trunk/WebKitTools/ChangeLog
r64530 r64534 1 2010-08-02 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Chromium DevTools: Get rid of DevTools RPC. 6 7 https://bugs.webkit.org/show_bug.cgi?id=43335 8 9 * DumpRenderTree/chromium/DRTDevToolsAgent.cpp: 10 (DRTDevToolsAgent::sendMessageToInspectorFrontend): 11 (DRTDevToolsAgent::call): 12 * DumpRenderTree/chromium/DRTDevToolsAgent.h: 13 * DumpRenderTree/chromium/DRTDevToolsCallArgs.h: 14 (DRTDevToolsCallArgs::DRTDevToolsCallArgs): 15 * DumpRenderTree/chromium/DRTDevToolsClient.cpp: 16 (DRTDevToolsClient::sendMessageToBackend): 17 (DRTDevToolsClient::call): 18 * DumpRenderTree/chromium/DRTDevToolsClient.h: 19 1 20 2010-08-02 Kent Tamura <tkent@chromium.org> 2 21 -
trunk/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
r62545 r64534 37 37 #include "public/WebCString.h" 38 38 #include "public/WebDevToolsAgent.h" 39 #include "public/WebDevToolsMessageData.h"40 39 #include "public/WebString.h" 41 40 #include "public/WebView.h" … … 61 60 } 62 61 63 void DRTDevToolsAgent::sendMessageTo Frontend(const WebDevToolsMessageData& data)62 void DRTDevToolsAgent::sendMessageToInspectorFrontend(const WebKit::WebString& data) 64 63 { 65 64 if (m_drtDevToolsClient) … … 101 100 WebDevToolsAgent* agent = webDevToolsAgent(); 102 101 if (agent) 103 agent->dispatch MessageFromFrontend(args.m_data);102 agent->dispatchOnInspectorBackend(args.m_data); 104 103 if (DRTDevToolsCallArgs::callsCount() == 1 && m_drtDevToolsClient) 105 104 m_drtDevToolsClient->allMessagesProcessed(); -
trunk/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h
r62545 r64534 57 57 58 58 // WebDevToolsAgentClient implementation. 59 virtual void sendMessageTo Frontend(const WebKit::WebDevToolsMessageData&);59 virtual void sendMessageToInspectorFrontend(const WebKit::WebString&); 60 60 virtual int hostIdentifier() { return m_routingID; } 61 61 virtual void forceRepaint(); -
trunk/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h
r62545 r64534 32 32 #define DRTDevToolsCallArgs_h 33 33 34 #include "public/WebDevToolsMessageData.h"35 34 #include "public/WebString.h" 36 35 #include <wtf/Assertions.h> … … 38 37 class DRTDevToolsCallArgs { 39 38 public: 40 DRTDevToolsCallArgs(const WebKit::Web DevToolsMessageData& data)39 DRTDevToolsCallArgs(const WebKit::WebString& data) 41 40 : m_data(data) 42 41 { 43 42 ++m_callsCount; 44 45 // The same behaviour as we have in case of IPC.46 for (size_t i = 0; i < m_data.arguments.size(); ++i) {47 if (m_data.arguments[i].isNull())48 m_data.arguments[i] = WebKit::WebString::fromUTF8("");49 }50 43 } 51 44 … … 64 57 static int callsCount() { return m_callsCount; } 65 58 66 WebKit::Web DevToolsMessageDatam_data;59 WebKit::WebString m_data; 67 60 68 61 private: -
trunk/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
r62740 r64534 65 65 } 66 66 67 void DRTDevToolsClient::sendMessageTo Agent(const WebDevToolsMessageData& data)67 void DRTDevToolsClient::sendMessageToBackend(const WebString& data) 68 68 { 69 69 if (m_drtDevToolsAgent) … … 104 104 void DRTDevToolsClient::call(const DRTDevToolsCallArgs& args) 105 105 { 106 m_webDevToolsFrontend->dispatch MessageFromAgent(args.m_data);106 m_webDevToolsFrontend->dispatchOnInspectorFrontend(args.m_data); 107 107 if (DRTDevToolsCallArgs::callsCount() == 1) 108 108 allMessagesProcessed(); -
trunk/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h
r62545 r64534 56 56 57 57 // WebDevToolsFrontendClient implementation 58 virtual void sendMessageTo Agent(const WebKit::WebDevToolsMessageData&);58 virtual void sendMessageToBackend(const WebKit::WebString&); 59 59 virtual void sendDebuggerCommandToAgent(const WebKit::WebString& command); 60 60
Note: See TracChangeset
for help on using the changeset viewer.