| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "Document.h" | 9 #include "Document.h" |
| 10 #include "EventListener.h" | 10 #include "EventListener.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 34 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 35 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 35 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| 36 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" | 36 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" |
| 37 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 37 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
| 38 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" | 38 #include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h" |
| 39 #include "third_party/WebKit/WebKit/chromium/src/WebFrameImpl.h" | 39 #include "third_party/WebKit/WebKit/chromium/src/WebFrameImpl.h" |
| 40 #include "third_party/WebKit/WebKit/chromium/src/WebViewImpl.h" | 40 #include "third_party/WebKit/WebKit/chromium/src/WebViewImpl.h" |
| 41 #include "webkit/glue/devtools/bound_object.h" | 41 #include "webkit/glue/devtools/bound_object.h" |
| 42 #include "webkit/glue/devtools/debugger_agent_impl.h" | 42 #include "webkit/glue/devtools/debugger_agent_impl.h" |
| 43 #include "webkit/glue/devtools/debugger_agent_manager.h" | 43 #include "webkit/glue/devtools/debugger_agent_manager.h" |
| 44 #include "webkit/glue/devtools/profiler_agent_impl.h" | |
| 45 #include "webkit/glue/glue_util.h" | 44 #include "webkit/glue/glue_util.h" |
| 46 #include "webkit/glue/webdevtoolsagent_impl.h" | 45 #include "webkit/glue/webdevtoolsagent_impl.h" |
| 47 | 46 |
| 48 using WebCore::Document; | 47 using WebCore::Document; |
| 49 using WebCore::DocumentLoader; | 48 using WebCore::DocumentLoader; |
| 50 using WebCore::FrameLoader; | 49 using WebCore::FrameLoader; |
| 51 using WebCore::InjectedScriptHost; | 50 using WebCore::InjectedScriptHost; |
| 52 using WebCore::InspectorBackend; | 51 using WebCore::InspectorBackend; |
| 53 using WebCore::InspectorController; | 52 using WebCore::InspectorController; |
| 54 using WebCore::InspectorFrontend; | 53 using WebCore::InspectorFrontend; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 dispatcher->Set(v8::String::New("enabled"), v8::Boolean::New(enabled)); | 105 dispatcher->Set(v8::String::New("enabled"), v8::Boolean::New(enabled)); |
| 107 } | 106 } |
| 108 | 107 |
| 109 // TODO(pfeldman): Make this public in WebDevToolsAgent API. | 108 // TODO(pfeldman): Make this public in WebDevToolsAgent API. |
| 110 static const char kApuAgentFeatureName[] = "apu-agent"; | 109 static const char kApuAgentFeatureName[] = "apu-agent"; |
| 111 | 110 |
| 112 // Keep these in sync with the ones in inject_dispatch.js. | 111 // Keep these in sync with the ones in inject_dispatch.js. |
| 113 static const char kTimelineFeatureName[] = "timeline-profiler"; | 112 static const char kTimelineFeatureName[] = "timeline-profiler"; |
| 114 static const char kResourceTrackingFeatureName[] = "resource-tracking"; | 113 static const char kResourceTrackingFeatureName[] = "resource-tracking"; |
| 115 | 114 |
| 116 class IoRpcDelegate : public DevToolsRpc::Delegate { | |
| 117 public: | |
| 118 IoRpcDelegate() {} | |
| 119 virtual ~IoRpcDelegate() {} | |
| 120 virtual void SendRpcMessage(const String& class_name, | |
| 121 const String& method_name, | |
| 122 const String& p1, | |
| 123 const String& p2, | |
| 124 const String& p3) { | |
| 125 WebDevToolsAgentClient::sendMessageToFrontendOnIOThread( | |
| 126 webkit_glue::StringToWebString(class_name), | |
| 127 webkit_glue::StringToWebString(method_name), | |
| 128 webkit_glue::StringToWebString(p1), | |
| 129 webkit_glue::StringToWebString(p2), | |
| 130 webkit_glue::StringToWebString(p3)); | |
| 131 } | |
| 132 | |
| 133 private: | |
| 134 DISALLOW_COPY_AND_ASSIGN(IoRpcDelegate); | |
| 135 }; | |
| 136 | |
| 137 } // namespace | 115 } // namespace |
| 138 | 116 |
| 139 WebDevToolsAgentImpl::WebDevToolsAgentImpl( | 117 WebDevToolsAgentImpl::WebDevToolsAgentImpl( |
| 140 WebViewImpl* web_view_impl, | 118 WebViewImpl* web_view_impl, |
| 141 WebDevToolsAgentClient* client) | 119 WebDevToolsAgentClient* client) |
| 142 : host_id_(client->hostIdentifier()), | 120 : host_id_(client->hostIdentifier()), |
| 143 client_(client), | 121 client_(client), |
| 144 web_view_impl_(web_view_impl), | 122 web_view_impl_(web_view_impl), |
| 145 apu_agent_enabled_(false), | 123 apu_agent_enabled_(false), |
| 146 resource_tracking_was_enabled_(false), | 124 resource_tracking_was_enabled_(false), |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 void WebDevToolsAgent::debuggerPauseScript() { | 597 void WebDevToolsAgent::debuggerPauseScript() { |
| 620 DebuggerAgentManager::PauseScript(); | 598 DebuggerAgentManager::PauseScript(); |
| 621 } | 599 } |
| 622 | 600 |
| 623 // static | 601 // static |
| 624 void WebDevToolsAgent::setMessageLoopDispatchHandler( | 602 void WebDevToolsAgent::setMessageLoopDispatchHandler( |
| 625 MessageLoopDispatchHandler handler) { | 603 MessageLoopDispatchHandler handler) { |
| 626 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); | 604 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); |
| 627 } | 605 } |
| 628 | 606 |
| 629 // static | |
| 630 bool WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread( | |
| 631 const WebString& className, | |
| 632 const WebString& methodName, | |
| 633 const WebString& param1, | |
| 634 const WebString& param2, | |
| 635 const WebString& param3) { | |
| 636 IoRpcDelegate transport; | |
| 637 ProfilerAgentDelegateStub stub(&transport); | |
| 638 ProfilerAgentImpl agent(&stub); | |
| 639 return ProfilerAgentDispatch::Dispatch( | |
| 640 &agent, | |
| 641 webkit_glue::WebStringToString(className), | |
| 642 webkit_glue::WebStringToString(methodName), | |
| 643 webkit_glue::WebStringToString(param1), | |
| 644 webkit_glue::WebStringToString(param2), | |
| 645 webkit_glue::WebStringToString(param3)); | |
| 646 } | |
| 647 | |
| 648 } // namespace WebKit | 607 } // namespace WebKit |
| OLD | NEW |