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

Side by Side Diff: content/renderer/devtools/devtools_agent_filter.cc

Issue 198753002: Don't handle DispatchOnInspectorBackend msg for SharedWorkers in DevToolsAgentFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/renderer/devtools/devtools_agent_filter.h" 5 #include "content/renderer/devtools/devtools_agent_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "content/child/child_process.h"
9 #include "content/common/devtools_messages.h" 10 #include "content/common/devtools_messages.h"
10 #include "content/renderer/devtools/devtools_agent.h" 11 #include "content/renderer/devtools/devtools_agent.h"
11 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
12 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" 13 #include "third_party/WebKit/public/web/WebDevToolsAgent.h"
13 14
14 using blink::WebDevToolsAgent; 15 using blink::WebDevToolsAgent;
15 using blink::WebString; 16 using blink::WebString;
16 17
17 namespace content { 18 namespace content {
18 19
(...skipping 16 matching lines...) Expand all
35 private: 36 private:
36 std::string msg; 37 std::string msg;
37 int host_id; 38 int host_id;
38 }; 39 };
39 40
40 } // namespace 41 } // namespace
41 42
42 DevToolsAgentFilter::DevToolsAgentFilter() 43 DevToolsAgentFilter::DevToolsAgentFilter()
43 : message_handled_(false), 44 : message_handled_(false),
44 render_thread_loop_(base::MessageLoop::current()), 45 render_thread_loop_(base::MessageLoop::current()),
46 io_message_loop_proxy_(ChildProcess::current()->io_message_loop_proxy()),
45 current_routing_id_(0) {} 47 current_routing_id_(0) {}
46 48
47 bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) { 49 bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) {
48 // Dispatch debugger commands directly from IO. 50 // Dispatch debugger commands directly from IO.
49 message_handled_ = true; 51 message_handled_ = true;
50 current_routing_id_ = message.routing_id(); 52 current_routing_id_ = message.routing_id();
51 IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) 53 IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message)
52 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, 54 IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend,
53 OnDispatchOnInspectorBackend) 55 OnDispatchOnInspectorBackend)
54 IPC_MESSAGE_UNHANDLED(message_handled_ = false) 56 IPC_MESSAGE_UNHANDLED(message_handled_ = false)
55 IPC_END_MESSAGE_MAP() 57 IPC_END_MESSAGE_MAP()
56 return message_handled_; 58 return message_handled_;
57 } 59 }
58 60
59 DevToolsAgentFilter::~DevToolsAgentFilter() {} 61 DevToolsAgentFilter::~DevToolsAgentFilter() {}
60 62
61 void DevToolsAgentFilter::OnDispatchOnInspectorBackend( 63 void DevToolsAgentFilter::OnDispatchOnInspectorBackend(
62 const std::string& message) { 64 const std::string& message) {
65 if (shared_worker_routes_.find(current_routing_id_) !=
66 shared_worker_routes_.end()) {
67 message_handled_ = false;
yurys 2014/03/13 09:18:06 Can you describe how you are going to execute devt
68 return;
69 }
63 if (!WebDevToolsAgent::shouldInterruptForMessage( 70 if (!WebDevToolsAgent::shouldInterruptForMessage(
64 WebString::fromUTF8(message))) { 71 WebString::fromUTF8(message))) {
65 message_handled_ = false; 72 message_handled_ = false;
66 return; 73 return;
67 } 74 }
68 WebDevToolsAgent::interruptAndDispatch( 75 WebDevToolsAgent::interruptAndDispatch(
69 new MessageImpl(message, current_routing_id_)); 76 new MessageImpl(message, current_routing_id_));
70 77
71 render_thread_loop_->PostTask( 78 render_thread_loop_->PostTask(
72 FROM_HERE, base::Bind(&WebDevToolsAgent::processPendingMessages)); 79 FROM_HERE, base::Bind(&WebDevToolsAgent::processPendingMessages));
73 } 80 }
74 81
82 void DevToolsAgentFilter::AddSharedWorkerRouteOnUI(int32 routing_id) {
83 io_message_loop_proxy_->PostTask(
84 FROM_HERE,
85 base::Bind(&DevToolsAgentFilter::AddSharedWorkerRoute, this, routing_id));
86 }
87
88 void DevToolsAgentFilter::RemoveSharedWorkerRouteOnUI(int32 routing_id) {
89 io_message_loop_proxy_->PostTask(
90 FROM_HERE,
91 base::Bind(
92 &DevToolsAgentFilter::RemoveSharedWorkerRoute, this, routing_id));
93 }
94
95 void DevToolsAgentFilter::AddSharedWorkerRoute(int32 routing_id) {
96 shared_worker_routes_.insert(routing_id);
97 }
98
99 void DevToolsAgentFilter::RemoveSharedWorkerRoute(int32 routing_id) {
100 shared_worker_routes_.erase(routing_id);
101 }
102
75 } // namespace content 103 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/devtools/devtools_agent_filter.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698