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

Side by Side Diff: chrome/renderer/devtools_agent_filter.cc

Issue 467043: Revert 34040 - DevTools: make possible profiling of scripts doing heavy calcu... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/devtools_agent_filter.h ('k') | webkit/glue/devtools/debugger_agent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/renderer/devtools_agent_filter.h" 5 #include "chrome/renderer/devtools_agent_filter.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/common/devtools_messages.h" 8 #include "chrome/common/devtools_messages.h"
9 #include "chrome/common/render_messages.h"
10 #include "chrome/renderer/devtools_agent.h" 9 #include "chrome/renderer/devtools_agent.h"
11 #include "chrome/renderer/plugin_channel_host.h" 10 #include "chrome/renderer/plugin_channel_host.h"
12 #include "chrome/renderer/render_view.h" 11 #include "chrome/renderer/render_view.h"
13 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h" 12 #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgent.h"
14 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" 13 #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
15 14
16 using WebKit::WebDevToolsAgent; 15 using WebKit::WebDevToolsAgent;
17 using WebKit::WebString; 16 using WebKit::WebString;
18 17
19 // static 18 // static
20 void DevToolsAgentFilter::DispatchMessageLoop() { 19 void DevToolsAgentFilter::DispatchMessageLoop() {
21 MessageLoop* current = MessageLoop::current(); 20 MessageLoop* current = MessageLoop::current();
22 bool old_state = current->NestableTasksAllowed(); 21 bool old_state = current->NestableTasksAllowed();
23 current->SetNestableTasksAllowed(true); 22 current->SetNestableTasksAllowed(true);
24 current->RunAllPending(); 23 current->RunAllPending();
25 current->SetNestableTasksAllowed(old_state); 24 current->SetNestableTasksAllowed(old_state);
26 } 25 }
27 26
28 // static
29 IPC::Channel* DevToolsAgentFilter::channel_ = NULL;
30 // static
31 int DevToolsAgentFilter::current_routing_id_ = 0;
32
33 DevToolsAgentFilter::DevToolsAgentFilter() 27 DevToolsAgentFilter::DevToolsAgentFilter()
34 : message_handled_(false) { 28 : current_routing_id_(0) {
35 WebDevToolsAgent::setMessageLoopDispatchHandler( 29 WebDevToolsAgent::setMessageLoopDispatchHandler(
36 &DevToolsAgentFilter::DispatchMessageLoop); 30 &DevToolsAgentFilter::DispatchMessageLoop);
37 } 31 }
38 32
39 DevToolsAgentFilter::~DevToolsAgentFilter() { 33 DevToolsAgentFilter::~DevToolsAgentFilter() {
40 } 34 }
41 35
42 bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) { 36 bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) {
43 // Dispatch debugger commands directly from IO. 37 // Dispatch debugger commands directly from IO.
44 message_handled_ = true; 38 bool handled = true;
45 current_routing_id_ = message.routing_id(); 39 current_routing_id_ = message.routing_id();
46 IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) 40 IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message)
47 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand) 41 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand)
48 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerPauseScript, 42 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerPauseScript,
49 OnDebuggerPauseScript) 43 OnDebuggerPauseScript)
50 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_RpcMessage, OnRpcMessage) 44 IPC_MESSAGE_UNHANDLED(handled = false)
51 IPC_MESSAGE_UNHANDLED(message_handled_ = false)
52 IPC_END_MESSAGE_MAP() 45 IPC_END_MESSAGE_MAP()
53 return message_handled_; 46 return handled;
54 } 47 }
55 48
56 void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) { 49 void DevToolsAgentFilter::OnDebuggerCommand(const std::string& command) {
57 WebDevToolsAgent::executeDebuggerCommand( 50 WebDevToolsAgent::executeDebuggerCommand(
58 WebString::fromUTF8(command), current_routing_id_); 51 WebString::fromUTF8(command), current_routing_id_);
59 } 52 }
60 53
61 void DevToolsAgentFilter::OnDebuggerPauseScript() { 54 void DevToolsAgentFilter::OnDebuggerPauseScript() {
62 WebDevToolsAgent::debuggerPauseScript(); 55 WebDevToolsAgent::debuggerPauseScript();
63 } 56 }
64
65 void DevToolsAgentFilter::OnRpcMessage(const std::string& class_name,
66 const std::string& method_name,
67 const std::string& param1,
68 const std::string& param2,
69 const std::string& param3) {
70 message_handled_ = WebDevToolsAgent::dispatchMessageFromFrontendOnIOThread(
71 WebString::fromUTF8(class_name),
72 WebString::fromUTF8(method_name),
73 WebString::fromUTF8(param1),
74 WebString::fromUTF8(param2),
75 WebString::fromUTF8(param3));
76 }
77
78 // static
79 void DevToolsAgentFilter::SendRpcMessage(const std::string& class_name,
80 const std::string& method_name,
81 const std::string& param1,
82 const std::string& param2,
83 const std::string& param3) {
84 IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient(
85 current_routing_id_,
86 DevToolsClientMsg_RpcMessage(
87 class_name,
88 method_name,
89 param1,
90 param2,
91 param3));
92 channel_->Send(m);
93 }
OLDNEW
« 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