| 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" |
| 44 #include "webkit/glue/glue_util.h" | 45 #include "webkit/glue/glue_util.h" |
| 45 #include "webkit/glue/webdevtoolsagent_impl.h" | 46 #include "webkit/glue/webdevtoolsagent_impl.h" |
| 46 | 47 |
| 47 using WebCore::Document; | 48 using WebCore::Document; |
| 48 using WebCore::DocumentLoader; | 49 using WebCore::DocumentLoader; |
| 49 using WebCore::FrameLoader; | 50 using WebCore::FrameLoader; |
| 50 using WebCore::InjectedScriptHost; | 51 using WebCore::InjectedScriptHost; |
| 51 using WebCore::InspectorBackend; | 52 using WebCore::InspectorBackend; |
| 52 using WebCore::InspectorController; | 53 using WebCore::InspectorController; |
| 53 using WebCore::InspectorFrontend; | 54 using WebCore::InspectorFrontend; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 dispatcher->Set(v8::String::New("enabled"), v8::Boolean::New(enabled)); | 106 dispatcher->Set(v8::String::New("enabled"), v8::Boolean::New(enabled)); |
| 106 } | 107 } |
| 107 | 108 |
| 108 // TODO(pfeldman): Make this public in WebDevToolsAgent API. | 109 // TODO(pfeldman): Make this public in WebDevToolsAgent API. |
| 109 static const char kApuAgentFeatureName[] = "apu-agent"; | 110 static const char kApuAgentFeatureName[] = "apu-agent"; |
| 110 | 111 |
| 111 // Keep these in sync with the ones in inject_dispatch.js. | 112 // Keep these in sync with the ones in inject_dispatch.js. |
| 112 static const char kTimelineFeatureName[] = "timeline-profiler"; | 113 static const char kTimelineFeatureName[] = "timeline-profiler"; |
| 113 static const char kResourceTrackingFeatureName[] = "resource-tracking"; | 114 static const char kResourceTrackingFeatureName[] = "resource-tracking"; |
| 114 | 115 |
| 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 |
| 115 } // namespace | 137 } // namespace |
| 116 | 138 |
| 117 WebDevToolsAgentImpl::WebDevToolsAgentImpl( | 139 WebDevToolsAgentImpl::WebDevToolsAgentImpl( |
| 118 WebViewImpl* web_view_impl, | 140 WebViewImpl* web_view_impl, |
| 119 WebDevToolsAgentClient* client) | 141 WebDevToolsAgentClient* client) |
| 120 : host_id_(client->hostIdentifier()), | 142 : host_id_(client->hostIdentifier()), |
| 121 client_(client), | 143 client_(client), |
| 122 web_view_impl_(web_view_impl), | 144 web_view_impl_(web_view_impl), |
| 123 apu_agent_enabled_(false), | 145 apu_agent_enabled_(false), |
| 124 resource_tracking_was_enabled_(false), | 146 resource_tracking_was_enabled_(false), |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 void WebDevToolsAgent::debuggerPauseScript() { | 619 void WebDevToolsAgent::debuggerPauseScript() { |
| 598 DebuggerAgentManager::PauseScript(); | 620 DebuggerAgentManager::PauseScript(); |
| 599 } | 621 } |
| 600 | 622 |
| 601 // static | 623 // static |
| 602 void WebDevToolsAgent::setMessageLoopDispatchHandler( | 624 void WebDevToolsAgent::setMessageLoopDispatchHandler( |
| 603 MessageLoopDispatchHandler handler) { | 625 MessageLoopDispatchHandler handler) { |
| 604 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); | 626 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); |
| 605 } | 627 } |
| 606 | 628 |
| 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 |
| 607 } // namespace WebKit | 648 } // namespace WebKit |
| OLD | NEW |