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

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

Issue 198753002: Don't handle DispatchOnInspectorBackend msg for SharedWorkers in DevToolsAgentFilter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename OnUI to OnMainThread. 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
« no previous file with comments | « no previous file | content/renderer/devtools/devtools_agent_filter.cc » ('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) 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 #ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_ 5 #ifndef CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_
6 #define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_ 6 #define CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_
7 7
8 #include <set>
8 #include <string> 9 #include <string>
9 10
10 #include "ipc/ipc_channel_proxy.h" 11 #include "ipc/ipc_channel_proxy.h"
11 12
12 struct DevToolsMessageData; 13 struct DevToolsMessageData;
13 14
14 namespace base { 15 namespace base {
15 class MessageLoop; 16 class MessageLoop;
16 } 17 }
17 18
18 namespace content { 19 namespace content {
19 20
20 // DevToolsAgentFilter is registered as an IPC filter in order to be able to 21 // DevToolsAgentFilter is registered as an IPC filter in order to be able to
21 // dispatch messages while on the IO thread. The reason for that is that while 22 // dispatch messages while on the IO thread. The reason for that is that while
22 // debugging, Render thread is being held by the v8 and hence no messages 23 // debugging, Render thread is being held by the v8 and hence no messages
23 // are being dispatched there. While holding the thread in a tight loop, 24 // are being dispatched there. While holding the thread in a tight loop,
24 // v8 provides thread-safe Api for controlling debugger. In our case v8's Api 25 // v8 provides thread-safe Api for controlling debugger. In our case v8's Api
25 // is being used from this communication agent on the IO thread. 26 // is being used from this communication agent on the IO thread.
26 class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter { 27 class DevToolsAgentFilter : public IPC::ChannelProxy::MessageFilter {
27 public: 28 public:
28 // There is a single instance of this class instantiated by the RenderThread. 29 // There is a single instance of this class instantiated by the RenderThread.
29 DevToolsAgentFilter(); 30 DevToolsAgentFilter();
30 31
31 static void SendRpcMessage(const DevToolsMessageData& data); 32 static void SendRpcMessage(const DevToolsMessageData& data);
32 33
33 // IPC::ChannelProxy::MessageFilter override. Called on IO thread. 34 // IPC::ChannelProxy::MessageFilter override. Called on IO thread.
34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 35 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
35 36
37 // Called on the main thread.
38 void AddSharedWorkerRouteOnMainThread(int32 routing_id);
39 void RemoveSharedWorkerRouteOnMainThread(int32 routing_id);
40
36 protected: 41 protected:
37 virtual ~DevToolsAgentFilter(); 42 virtual ~DevToolsAgentFilter();
38 43
39 private: 44 private:
40 void OnDispatchOnInspectorBackend(const std::string& message); 45 void OnDispatchOnInspectorBackend(const std::string& message);
41 46
47 // Called on IO thread
48 void AddSharedWorkerRoute(int32 routing_id);
49 void RemoveSharedWorkerRoute(int32 routing_id);
50
42 bool message_handled_; 51 bool message_handled_;
43 base::MessageLoop* render_thread_loop_; 52 base::MessageLoop* render_thread_loop_;
53 // Proxy to the IO message loop.
54 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
44 int current_routing_id_; 55 int current_routing_id_;
45 56
57 std::set<int32> shared_worker_routes_;
58
46 DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter); 59 DISALLOW_COPY_AND_ASSIGN(DevToolsAgentFilter);
47 }; 60 };
48 61
49 } // namespace content 62 } // namespace content
50 63
51 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_ 64 #endif // CONTENT_RENDERER_DEVTOOLS_DEVTOOLS_AGENT_FILTER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/devtools/devtools_agent_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698