summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 23:57:18 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-12 23:57:18 +0000
commit2f7f4d591192cfdebee227b72e3cf57c7c604450 (patch)
tree181fc0fc257b6203c3ca2affb33f4b143de5fd3c
parent5a8459aa45b09a6cdcdd90ca190ba353799e3464 (diff)
downloadchromium_src-2f7f4d591192cfdebee227b72e3cf57c7c604450.zip
chromium_src-2f7f4d591192cfdebee227b72e3cf57c7c604450.tar.gz
chromium_src-2f7f4d591192cfdebee227b72e3cf57c7c604450.tar.bz2
Enables the sending of Timeline Agent and Resource messages to the devtools api in extensions.
Review URL: http://codereview.chromium.org/267013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28761 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_devtools_bridge.cc33
-rw-r--r--chrome/browser/extensions/extension_devtools_bridge.h1
-rw-r--r--chrome/browser/extensions/extension_devtools_browsertests.cc13
-rw-r--r--chrome/browser/extensions/extension_devtools_events.cc9
-rw-r--r--chrome/browser/extensions/extension_devtools_events.h3
-rw-r--r--chrome/common/devtools_messages_internal.h3
-rw-r--r--chrome/renderer/devtools_agent.cc9
-rw-r--r--chrome/renderer/devtools_agent.h1
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js2
-rw-r--r--chrome/test/data/extensions/devtools/timeline_api/background.html16
-rw-r--r--chrome/test/data/extensions/devtools/timeline_api_two/background_two.html6
-rw-r--r--webkit/glue/devtools/apu_agent_delegate.h16
-rw-r--r--webkit/glue/devtools/js/inject_dispatch.js27
-rw-r--r--webkit/glue/webdevtoolsagent.h2
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc54
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h6
-rw-r--r--webkit/webkit.gyp1
17 files changed, 135 insertions, 67 deletions
diff --git a/chrome/browser/extensions/extension_devtools_bridge.cc b/chrome/browser/extensions/extension_devtools_bridge.cc
index 2702394..da5885a 100644
--- a/chrome/browser/extensions/extension_devtools_bridge.cc
+++ b/chrome/browser/extensions/extension_devtools_bridge.cc
@@ -21,8 +21,6 @@ ExtensionDevToolsBridge::ExtensionDevToolsBridge(int tab_id,
profile_(profile),
on_page_event_name_(
ExtensionDevToolsEvents::OnPageEventNameForTab(tab_id)),
- on_tab_url_change_event_name_(
- ExtensionDevToolsEvents::OnTabUrlChangeEventNameForTab(tab_id)),
on_tab_close_event_name_(
ExtensionDevToolsEvents::OnTabCloseEventNameForTab(tab_id)) {
extension_devtools_manager_ = profile_->GetExtensionDevToolsManager();
@@ -42,8 +40,12 @@ bool ExtensionDevToolsBridge::RegisterAsDevToolsClientHost() {
if (ExtensionTabUtil::GetTabById(tab_id_, profile_, &browser, &tab_strip,
&contents, &tab_index)) {
inspected_rvh_ = contents->render_view_host();
- DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(
+ DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
+ devtools_manager->RegisterDevToolsClientHostFor(
inspected_rvh_, this);
+ devtools_manager->ForwardToDevToolsAgent(
+ this,
+ DevToolsAgentMsg_SetApuAgentEnabled(true));
return true;
}
return false;
@@ -64,6 +66,8 @@ void ExtensionDevToolsBridge::UnregisterAsDevToolsClientHost() {
void ExtensionDevToolsBridge::InspectedTabClosing() {
DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
+ // TODO(knorton): Remove this event in favor of the standard tabs.onRemoved
+ // event in extensions.
std::string json("[{}]");
profile_->GetExtensionMessageService()->
DispatchEventToRenderers(on_tab_close_event_name_, json);
@@ -79,9 +83,8 @@ void ExtensionDevToolsBridge::SendMessageToClient(const IPC::Message& msg) {
IPC_END_MESSAGE_MAP()
}
-static const char kTimelineAgentClassName[] = "TimelineAgentClass";
-static const char kPageEventMessageName[] = "PageEventMessage";
-static const char kTabUrlChangeEventMessageName[] = "TabUrlChangeEventMessage";
+static const char kApuAgentClassName[] = "ApuAgentDelegate";
+static const char kApuPageEventMessageName[] = "DispatchToApu";
void ExtensionDevToolsBridge::OnRpcMessage(const std::string& class_name,
const std::string& message_name,
@@ -89,18 +92,12 @@ void ExtensionDevToolsBridge::OnRpcMessage(const std::string& class_name,
const std::string& param2,
const std::string& param3) {
DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
- // TODO(jamesr): Update the filtering and message creation logic once
- // the TimelineAgent lands in WebKit.
- if (class_name == kTimelineAgentClassName) {
- if (message_name == kPageEventMessageName) {
- std::string json = StringPrintf("[{\"record\": \"%s\"}]", param1.c_str());
- profile_->GetExtensionMessageService()->
- DispatchEventToRenderers(on_page_event_name_, json);
- } else if (message_name == kTabUrlChangeEventMessageName) {
- std::string json = StringPrintf("[{\"record\": \"%s\"}]", param1.c_str());
- profile_->GetExtensionMessageService()->
- DispatchEventToRenderers(on_tab_url_change_event_name_, json);
- }
+
+ if (class_name == kApuAgentClassName
+ && message_name == kApuPageEventMessageName) {
+ std::string json = StringPrintf("[%s]", param1.c_str());
+ profile_->GetExtensionMessageService()->DispatchEventToRenderers(
+ on_page_event_name_, json);
}
}
diff --git a/chrome/browser/extensions/extension_devtools_bridge.h b/chrome/browser/extensions/extension_devtools_bridge.h
index d6fd960..7cbbc8f 100644
--- a/chrome/browser/extensions/extension_devtools_bridge.h
+++ b/chrome/browser/extensions/extension_devtools_bridge.h
@@ -52,7 +52,6 @@ class ExtensionDevToolsBridge : public DevToolsClientHost {
// The names of the events fired at extensions depend on the tab id,
// so we store the various event names in each bridge.
const std::string on_page_event_name_;
- const std::string on_tab_url_change_event_name_;
const std::string on_tab_close_event_name_;
DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsBridge);
diff --git a/chrome/browser/extensions/extension_devtools_browsertests.cc b/chrome/browser/extensions/extension_devtools_browsertests.cc
index 19f7ba4..a2eff3c 100644
--- a/chrome/browser/extensions/extension_devtools_browsertests.cc
+++ b/chrome/browser/extensions/extension_devtools_browsertests.cc
@@ -79,21 +79,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionDevToolsBrowserTest, TimelineApi) {
tab_contents->render_view_host());
ASSERT_TRUE(devtools_client_host);
- // Test onTabUrlChange event.
- DevToolsClientMsg_RpcMessage tabUrlChangeEventMessage(
- "TimelineAgentClass", "TabUrlChangeEventMessage", "", "", "");
- devtools_client_host->SendMessageToClient(tabUrlChangeEventMessage);
- ui_test_utils::ExecuteJavaScriptAndExtractBool(
- host->render_view_host(),
- L"",
- L"testReceiveTabUrlChangeEvent()",
- &result);
- EXPECT_TRUE(result);
-
// Test onPageEvent event.
result = false;
DevToolsClientMsg_RpcMessage pageEventMessage(
- "TimelineAgentClass", "PageEventMessage", "", "", "");
+ "ApuAgentDelegate", "DispatchToApu", "", "", "");
devtools_client_host->SendMessageToClient(pageEventMessage);
ui_test_utils::ExecuteJavaScriptAndExtractBool(
host->render_view_host(), L"", L"testReceivePageEvent()", &result);
diff --git a/chrome/browser/extensions/extension_devtools_events.cc b/chrome/browser/extensions/extension_devtools_events.cc
index 979726c..bec5577 100644
--- a/chrome/browser/extensions/extension_devtools_events.cc
+++ b/chrome/browser/extensions/extension_devtools_events.cc
@@ -12,7 +12,6 @@
// in sync with chrome/renderer/resources/extension_process_bindings.js
static const char kDevToolsEventPrefix[] = "devtools.";
static const char kOnPageEventName[] = "onPageEvent";
-static const char kOnTabUrlChangeEventName[] = "onTabUrlChange";
static const char kOnTabCloseEventName[] = "onTabClose";
// static
@@ -43,14 +42,6 @@ std::string ExtensionDevToolsEvents::OnPageEventNameForTab(int tab_id) {
}
// static
-std::string ExtensionDevToolsEvents::OnTabUrlChangeEventNameForTab(int tab_id) {
- return StringPrintf("%s%d.%s",
- kDevToolsEventPrefix,
- tab_id,
- kOnTabUrlChangeEventName);
-}
-
-// static
std::string ExtensionDevToolsEvents::OnTabCloseEventNameForTab(int tab_id) {
return StringPrintf("%s%d.%s",
kDevToolsEventPrefix,
diff --git a/chrome/browser/extensions/extension_devtools_events.h b/chrome/browser/extensions/extension_devtools_events.h
index ff985b2..c1dd363 100644
--- a/chrome/browser/extensions/extension_devtools_events.h
+++ b/chrome/browser/extensions/extension_devtools_events.h
@@ -22,9 +22,6 @@ class ExtensionDevToolsEvents {
// Generates the event string for an onPageEvent for a given tab.
static std::string OnPageEventNameForTab(int tab_id);
- // Generates the event string for an onPageEvent for a given tab.
- static std::string OnTabUrlChangeEventNameForTab(int tab_id);
-
// Generates the event string for an onTabCloseEvent for a given tab.
static std::string OnTabCloseEventNameForTab(int tab_id);
diff --git a/chrome/common/devtools_messages_internal.h b/chrome/common/devtools_messages_internal.h
index e139c6c..d91166f 100644
--- a/chrome/common/devtools_messages_internal.h
+++ b/chrome/common/devtools_messages_internal.h
@@ -90,4 +90,7 @@ IPC_BEGIN_MESSAGES(DevToolsAgent)
int /* x */,
int /* y */)
+ // Enables/disables the apu agent.
+ IPC_MESSAGE_CONTROL1(DevToolsAgentMsg_SetApuAgentEnabled, bool /* enabled */)
+
IPC_END_MESSAGES(DevToolsAgent)
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc
index 74af788..aa6baad3 100644
--- a/chrome/renderer/devtools_agent.cc
+++ b/chrome/renderer/devtools_agent.cc
@@ -37,6 +37,8 @@ bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement)
+ IPC_MESSAGE_HANDLER(DevToolsAgentMsg_SetApuAgentEnabled,
+ OnSetApuAgentEnabled)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -106,6 +108,13 @@ void DevToolsAgent::OnInspectElement(int x, int y) {
}
}
+void DevToolsAgent::OnSetApuAgentEnabled(bool enabled) {
+ WebDevToolsAgent* web_agent = GetWebAgent();
+ if (web_agent) {
+ web_agent->SetApuAgentEnabled(enabled);
+ }
+}
+
WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
WebView* web_view = view_->webview();
if (!web_view)
diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h
index 25906ae..6cd5d97 100644
--- a/chrome/renderer/devtools_agent.h
+++ b/chrome/renderer/devtools_agent.h
@@ -58,6 +58,7 @@ class DevToolsAgent : public WebDevToolsAgentDelegate {
const std::string& param2,
const std::string& param3);
void OnInspectElement(int x, int y);
+ void OnSetApuAgentEnabled(bool enabled);
static std::map<int, DevToolsAgent*> agent_for_routing_id_;
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index 0ac0be4..3f6c267 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -316,7 +316,7 @@ var chrome = chrome || {};
apiFunctions["devtools.getTabEvents"].handleRequest = function(tabId) {
var tabIdProxy = {};
- var functions = ["onPageEvent", "onTabUrlChange", "onTabClose"];
+ var functions = ["onPageEvent", "onTabClose"];
functions.forEach(function(name) {
// Event disambiguation is handled by name munging. See
// chrome/browser/extensions/extension_devtools_events.h for the C++
diff --git a/chrome/test/data/extensions/devtools/timeline_api/background.html b/chrome/test/data/extensions/devtools/timeline_api/background.html
index 1b98882..eec14ed 100644
--- a/chrome/test/data/extensions/devtools/timeline_api/background.html
+++ b/chrome/test/data/extensions/devtools/timeline_api/background.html
@@ -3,10 +3,6 @@
var receivedEvents = [];
var devtoolsTabEvents = undefined;
-function tabUrlChangeListener() {
- receivedEvents.push("onTabUrlChange");
-}
-
function pageEventListener() {
receivedEvents.push("onPageEvent");
}
@@ -19,7 +15,6 @@ function setListenersOnTab(tabId) {
try {
devtoolsTabEvents = chrome.devtools.getTabEvents(tabId);
devtoolsTabEvents.onPageEvent.addListener(pageEventListener);
- devtoolsTabEvents.onTabUrlChange.addListener(tabUrlChangeListener);
devtoolsTabEvents.onTabClose.addListener(tabCloseListener);
window.domAutomationController.send(true);
} catch(e) {
@@ -27,16 +22,6 @@ function setListenersOnTab(tabId) {
}
}
-function testReceiveTabUrlChangeEvent() {
- if (receivedEvents.length == 1) {
- var eventName = receivedEvents.pop();
- window.domAutomationController.send(eventName === "onTabUrlChange");
- } else {
- receivedEvents = [];
- window.domAutomationController.send(false);
- }
-}
-
function testReceivePageEvent() {
if (receivedEvents.length == 1) {
var eventName = receivedEvents.pop();
@@ -59,7 +44,6 @@ function testReceiveTabCloseEvent() {
function unregisterListeners() {
devtoolsTabEvents.onPageEvent.removeListener(pageEventListener);
- devtoolsTabEvents.onTabUrlChange.removeListener(tabUrlChangeListener);
devtoolsTabEvents.onTabClose.removeListener(tabCloseListener);
window.domAutomationController.send(true);
}
diff --git a/chrome/test/data/extensions/devtools/timeline_api_two/background_two.html b/chrome/test/data/extensions/devtools/timeline_api_two/background_two.html
index fa0422e..f22fcd5 100644
--- a/chrome/test/data/extensions/devtools/timeline_api_two/background_two.html
+++ b/chrome/test/data/extensions/devtools/timeline_api_two/background_two.html
@@ -2,10 +2,6 @@
var devtoolsTabEvents = undefined;
-function tabUrlChangeListener() {
- receivedEvents.push("onTabUrlChange");
-}
-
function pageEventListener() {
receivedEvents.push("onPageEvent");
}
@@ -17,14 +13,12 @@ function tabCloseListener() {
function registerListenersForTab(tabId) {
devtoolsTabEvents = chrome.devtools.getTabEvents(tabId);
devtoolsTabEvents.onPageEvent.addListener(pageEventListener);
- devtoolsTabEvents.onTabUrlChange.addListener(tabUrlChangeListener);
devtoolsTabEvents.onTabClose.addListener(tabCloseListener);
window.domAutomationController.send(true);
}
function unregisterListeners() {
devtoolsTabEvents.onPageEvent.removeListener(pageEventListener);
- devtoolsTabEvents.onTabUrlChange.removeListener(tabUrlChangeListener);
devtoolsTabEvents.onTabClose.removeListener(tabCloseListener);
window.domAutomationController.send(true);
}
diff --git a/webkit/glue/devtools/apu_agent_delegate.h b/webkit/glue/devtools/apu_agent_delegate.h
new file mode 100644
index 0000000..17965d9
--- /dev/null
+++ b/webkit/glue/devtools/apu_agent_delegate.h
@@ -0,0 +1,16 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_GLUE_DEVTOOLS_APU_AGENT_DELEGATE_H_
+#define WEBKIT_GLUE_DEVTOOLS_APU_AGENT_DELEGATE_H_
+
+#include "webkit/glue/devtools/devtools_rpc.h"
+
+#define APU_AGENT_DELEGATE_STRUCT(METHOD0, METHOD1, METHOD2, METHOD3) \
+ /* Sends a json object to apu. */ \
+ METHOD1(DispatchToApu, String /* data */)
+
+DEFINE_RPC_CLASS(ApuAgentDelegate, APU_AGENT_DELEGATE_STRUCT)
+
+#endif // WEBKIT_GLUE_DEVTOOLS_APU_AGENT_DELEGATE_H_
diff --git a/webkit/glue/devtools/js/inject_dispatch.js b/webkit/glue/devtools/js/inject_dispatch.js
index 16dd56f..96c3fac 100644
--- a/webkit/glue/devtools/js/inject_dispatch.js
+++ b/webkit/glue/devtools/js/inject_dispatch.js
@@ -9,7 +9,6 @@
var InspectorControllerDispatcher = {};
-
/**
* Main dispatch method, all calls from the host to InspectorController go
* through this one.
@@ -22,6 +21,27 @@ InspectorControllerDispatcher.dispatch = function(functionName, json_args) {
InspectorController[functionName].apply(InspectorController, params);
};
+/**
+ * Special controller object for APU related messages. Outgoing messages
+ * are sent to this object if the ApuAgentDispatcher is enabled.
+ **/
+var ApuAgentDispatcher = { enabled : false };
+
+/**
+ * Dispatches messages to APU. This filters and transforms
+ * outgoing messages that are used by APU.
+ * @param {string} method name of the dispatch method.
+ **/
+ApuAgentDispatcher.dispatchToApu = function(method, args) {
+ if (method != 'addItemToTimeline' &&
+ method != 'updateResource' &&
+ method != 'addResource') {
+ return;
+ }
+ // TODO(knorton): Transform args so they can be used
+ // by APU.
+ DevToolsAgentHost.dispatchToApu(JSON.stringify(args));
+};
/**
* This is called by the InspectorFrontend for serialization.
@@ -41,6 +61,11 @@ function dispatch(method, var_args) {
return;
}
+ if (ApuAgentDispatcher.enabled) {
+ ApuAgentDispatcher.dispatchToApu(method, args);
+ return;
+ }
+
var call = JSON.stringify(args);
DevToolsAgentHost.dispatch(call);
};
diff --git a/webkit/glue/webdevtoolsagent.h b/webkit/glue/webdevtoolsagent.h
index 37ab24f..aca37ee 100644
--- a/webkit/glue/webdevtoolsagent.h
+++ b/webkit/glue/webdevtoolsagent.h
@@ -38,6 +38,8 @@ class WebDevToolsAgent {
virtual void InspectElement(int x, int y) = 0;
+ virtual void SetApuAgentEnabled(bool enabled) = 0;
+
// Asynchronously executes debugger command in the render thread.
// |caller_id| will be used for sending response.
static void ExecuteDebuggerCommand(const std::string& command,
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index a96143a..680033d 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -64,6 +64,18 @@ void InspectorBackendWeakReferenceCallback(v8::Persistent<v8::Value> object,
object.Dispose();
}
+void SetApuAgentEnabledInUtilityContext(v8::Handle<v8::Context> context,
+ bool enabled) {
+ v8::HandleScope handle_scope;
+ v8::Context::Scope context_scope(context);
+ v8::Handle<v8::Object> dispatcher = v8::Local<v8::Object>::Cast(
+ context->Global()->Get(v8::String::New("ApuAgentDispatcher")));
+ if (dispatcher.IsEmpty()) {
+ return;
+ }
+ dispatcher->Set(v8::String::New("enabled"), v8::Boolean::New(enabled));
+}
+
} // namespace
WebDevToolsAgentImpl::WebDevToolsAgentImpl(
@@ -72,10 +84,13 @@ WebDevToolsAgentImpl::WebDevToolsAgentImpl(
: host_id_(delegate->GetHostId()),
delegate_(delegate),
web_view_impl_(web_view_impl),
+ apu_agent_enabled_(false),
+ resource_tracking_was_enabled_(false),
attached_(false) {
debugger_agent_delegate_stub_.set(new DebuggerAgentDelegateStub(this));
tools_agent_delegate_stub_.set(new ToolsAgentDelegateStub(this));
tools_agent_native_delegate_stub_.set(new ToolsAgentNativeDelegateStub(this));
+ apu_agent_delegate_stub_.set(new ApuAgentDelegateStub(this));
}
WebDevToolsAgentImpl::~WebDevToolsAgentImpl() {
@@ -146,6 +161,7 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame(
ResetInspectorFrontendProxy();
tools_agent_delegate_stub_->FrameNavigate(
url.possibly_invalid_spec());
+ SetApuAgentEnabledInUtilityContext(utility_context_, apu_agent_enabled_);
}
UnhideResourcesPanelIfNecessary();
}
@@ -213,6 +229,27 @@ void WebDevToolsAgentImpl::GetResourceContent(
tools_agent_native_delegate_stub_->DidGetResourceContent(call_id, content);
}
+void WebDevToolsAgentImpl::SetApuAgentEnabled(bool enable) {
+ apu_agent_enabled_ = enable;
+ SetApuAgentEnabledInUtilityContext(utility_context_, enable);
+ InspectorController* ic = web_view_impl_->page()->inspectorController();
+ if (enable) {
+ resource_tracking_was_enabled_ = ic->resourceTrackingEnabled();
+ ic->enableTimeline(false);
+ if (!resource_tracking_was_enabled_) {
+ // TODO(knorton): Introduce some kind of agents dependency here so that
+ // user could turn off resource tracking while apu agent is on.
+ ic->enableResourceTracking(false);
+ }
+ } else {
+ ic->disableTimeline(false);
+ if (!resource_tracking_was_enabled_) {
+ ic->disableResourceTracking(false);
+ }
+ resource_tracking_was_enabled_ = false;
+ }
+}
+
void WebDevToolsAgentImpl::DispatchMessageFromClient(
const std::string& class_name,
const std::string& method_name,
@@ -261,6 +298,9 @@ void WebDevToolsAgentImpl::InitDevToolsAgentHost() {
devtools_agent_host_->AddProtoFunction(
"dispatch",
WebDevToolsAgentImpl::JsDispatchOnClient);
+ devtools_agent_host_->AddProtoFunction(
+ "dispatchToApu",
+ WebDevToolsAgentImpl::JsDispatchToApu);
devtools_agent_host_->Build();
v8::HandleScope scope;
@@ -340,6 +380,20 @@ v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchOnClient(
}
// static
+v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchToApu(
+ const v8::Arguments& args) {
+ v8::TryCatch exception_catcher;
+ String message = WebCore::toWebCoreStringWithNullCheck(args[0]);
+ if (message.isEmpty() || exception_catcher.HasCaught()) {
+ return v8::Undefined();
+ }
+ WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(
+ v8::External::Cast(*args.Data())->Value());
+ agent->apu_agent_delegate_stub_->DispatchToApu(message);
+ return v8::Undefined();
+}
+
+// static
void WebDevToolsAgent::ExecuteDebuggerCommand(
const std::string& command,
int caller_id) {
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
index 0a1ff97..b4efbe0 100644
--- a/webkit/glue/webdevtoolsagent_impl.h
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -11,6 +11,7 @@
#include "v8.h"
#include "webkit/glue/devtools/devtools_rpc.h"
+#include "webkit/glue/devtools/apu_agent_delegate.h"
#include "webkit/glue/devtools/tools_agent.h"
#include "webkit/glue/webdevtoolsagent.h"
@@ -55,6 +56,7 @@ class WebDevToolsAgentImpl
virtual void GetResourceContent(
int call_id,
int identifier);
+ virtual void SetApuAgentEnabled(bool enable);
// WebDevToolsAgent implementation.
virtual void Attach();
@@ -88,6 +90,7 @@ class WebDevToolsAgentImpl
private:
static v8::Handle<v8::Value> JsDispatchOnClient(const v8::Arguments& args);
+ static v8::Handle<v8::Value> JsDispatchToApu(const v8::Arguments& args);
void DisposeUtilityContext();
void UnhideResourcesPanelIfNecessary();
@@ -107,6 +110,9 @@ class WebDevToolsAgentImpl
OwnPtr<ToolsAgentDelegateStub> tools_agent_delegate_stub_;
OwnPtr<ToolsAgentNativeDelegateStub> tools_agent_native_delegate_stub_;
OwnPtr<DebuggerAgentImpl> debugger_agent_impl_;
+ OwnPtr<ApuAgentDelegateStub> apu_agent_delegate_stub_;
+ bool apu_agent_enabled_;
+ bool resource_tracking_was_enabled_;
bool attached_;
// TODO(pfeldman): This should not be needed once GC styles issue is fixed
// for matching rules.
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 5c04aac..30268fc 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -475,6 +475,7 @@
# This list contains all .h, .cc, and .mm files in glue except for
# those in the test subdirectory and those with unittest in in their
# names.
+ 'glue/devtools/apu_agent_delegate.h',
'glue/devtools/devtools_rpc.h',
'glue/devtools/devtools_rpc_js.h',
'glue/devtools/bound_object.cc',