Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2850)

Unified Diff: chrome/renderer/devtools_agent_filter.cc

Issue 460018: DevTools: make possible profiling of scripts doing heavy calculations. (Closed)
Patch Set: Comments addressed Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/devtools_agent_filter.h ('k') | webkit/glue/devtools/debugger_agent.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/devtools_agent_filter.cc
diff --git a/chrome/renderer/devtools_agent_filter.cc b/chrome/renderer/devtools_agent_filter.cc
index 93b6c752faa27e2080a19d1b86a0c6bbd03549bb..375c74303e26fd994f2ffed0ac90c5cf491dba1e 100644
--- a/chrome/renderer/devtools_agent_filter.cc
+++ b/chrome/renderer/devtools_agent_filter.cc
@@ -6,6 +6,7 @@
#include "base/message_loop.h"
#include "chrome/common/devtools_messages.h"
+#include "chrome/common/render_messages.h"
#include "chrome/renderer/devtools_agent.h"
#include "chrome/renderer/plugin_channel_host.h"
#include "chrome/renderer/render_view.h"
@@ -24,8 +25,13 @@ void DevToolsAgentFilter::DispatchMessageLoop() {
current->SetNestableTasksAllowed(old_state);
}
+// static
+IPC::Channel* DevToolsAgentFilter::channel_ = NULL;
+// static
+int DevToolsAgentFilter::current_routing_id_ = 0;
+
DevToolsAgentFilter::DevToolsAgentFilter()
- : current_routing_id_(0) {
+ : message_handled_(false) {
WebDevToolsAgent::setMessageLoopDispatchHandler(
&DevToolsAgentFilter::DispatchMessageLoop);
}
@@ -35,15 +41,16 @@ DevToolsAgentFilter::~DevToolsAgentFilter() {
bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) {
// Dispatch debugger commands directly from IO.
- bool handled = true;
+ message_handled_ = true;
current_routing_id_ = message.routing_id();
IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand)
IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerPauseScript,
OnDebuggerPauseScript)
- IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage)
+ IPC_MESSAGE_UNHANDLED(message_handled_ = false)
IPC_END_MESSAGE_MAP()
- return handled;
+ return message_handled_;
}
void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) {
@@ -54,3 +61,33 @@ void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) {
void DevToolsAgentFilter::OnDebuggerPauseScript() {
WebDevToolsAgent::debuggerPauseScript();
}
+
+void DevToolsAgentFilter::OnRpcMessage(const std::string& class_name,
+ const std::string& method_name,
+ const std::string& param1,
+ const std::string& param2,
+ const std::string& param3) {
+ message_handled_ = WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(
+ WebString::fromUTF8(class_name),
+ WebString::fromUTF8(method_name),
+ WebString::fromUTF8(param1),
+ WebString::fromUTF8(param2),
+ WebString::fromUTF8(param3));
+}
+
+// static
+void DevToolsAgentFilter::SendRpcMessage(const std::string& class_name,
+ const std::string& method_name,
+ const std::string& param1,
+ const std::string& param2,
+ const std::string& param3) {
+ IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
+ current_routing_id_,
+ DevToolsClientMsg_RpcMessage(
+ class_name,
+ method_name,
+ param1,
+ param2,
+ param3));
+ channel_->Send(m);
+}
« no previous file with comments | « chrome/renderer/devtools_agent_filter.h ('k') | webkit/glue/devtools/debugger_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698