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

Side by Side Diff: content/child/child_thread.h

Issue 203073005: (NOT READY FOR REVIEW) Introduce MessagePortBypassFilter. (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
« no previous file with comments | « no previous file | content/child/child_thread.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_CHILD_CHILD_THREAD_H_ 5 #ifndef CONTENT_CHILD_CHILD_THREAD_H_
6 #define CONTENT_CHILD_CHILD_THREAD_H_ 6 #define CONTENT_CHILD_CHILD_THREAD_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/power_monitor/power_monitor.h" 14 #include "base/power_monitor/power_monitor.h"
15 #include "base/tracked_objects.h" 15 #include "base/tracked_objects.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/common/message_router.h" 17 #include "content/common/message_router.h"
18 #include "ipc/ipc_channel_proxy.h"
18 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. 19 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
19 #include "webkit/child/resource_loader_bridge.h" 20 #include "webkit/child/resource_loader_bridge.h"
20 21
21 namespace base { 22 namespace base {
22 class MessageLoop; 23 class MessageLoop;
23 24
24 namespace debug { 25 namespace debug {
25 class TraceMemoryController; 26 class TraceMemoryController;
26 } // namespace debug 27 } // namespace debug
27 } // namespace base 28 } // namespace base
(...skipping 14 matching lines...) Expand all
42 class FileSystemDispatcher; 43 class FileSystemDispatcher;
43 class ServiceWorkerDispatcher; 44 class ServiceWorkerDispatcher;
44 class ServiceWorkerMessageFilter; 45 class ServiceWorkerMessageFilter;
45 class QuotaDispatcher; 46 class QuotaDispatcher;
46 class QuotaMessageFilter; 47 class QuotaMessageFilter;
47 class ResourceDispatcher; 48 class ResourceDispatcher;
48 class SocketStreamDispatcher; 49 class SocketStreamDispatcher;
49 class ThreadSafeSender; 50 class ThreadSafeSender;
50 class WebSocketDispatcher; 51 class WebSocketDispatcher;
51 52
53 class MessagePortBypassFilter : public IPC::ChannelProxy::MessageFilter {
54 public:
55 MessagePortBypassFilter(base::SingleThreadTaskRunner* ipc_task_runner);
56 virtual ~MessagePortBypassFilter();
57
58 // IPC::ChannelProxy::MessageFilter implementation.
59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
60 virtual bool GetSupportedMessageClasses(
61 std::vector<uint32>* supported_message_classes) const OVERRIDE;
62
63 void AddRoute(int32 routing_id, IPC::Listener* listener);
64 void RemoveRoute(int32 routing_id, const base::Closure& callback);
65
66 private:
67 void AddRouteOnIO(int32 routing_id, IPC::Listener* listener);
68 void RemoveRouteOnIO(int32 routing_id, const base::Closure& callback);
69
70 IDMap<IPC::Listener> routes_;
71 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_;
72 scoped_refptr<base::MessageLoopProxy> child_thread_loop_;
73 };
74
52 // The main thread of a child process derives from this class. 75 // The main thread of a child process derives from this class.
53 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { 76 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
54 public: 77 public:
55 // Creates the thread. 78 // Creates the thread.
56 ChildThread(); 79 ChildThread();
57 // Used for single-process mode and for in process gpu mode. 80 // Used for single-process mode and for in process gpu mode.
58 explicit ChildThread(const std::string& channel_name); 81 explicit ChildThread(const std::string& channel_name);
59 // ChildProcess::main_thread() is reset after Shutdown(), and before the 82 // ChildProcess::main_thread() is reset after Shutdown(), and before the
60 // destructor, so any subsystem that relies on ChildProcess::main_thread() 83 // destructor, so any subsystem that relies on ChildProcess::main_thread()
61 // must be terminated before Shutdown returns. In particular, if a subsystem 84 // must be terminated before Shutdown returns. In particular, if a subsystem
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 135 }
113 136
114 QuotaDispatcher* quota_dispatcher() const { 137 QuotaDispatcher* quota_dispatcher() const {
115 return quota_dispatcher_.get(); 138 return quota_dispatcher_.get();
116 } 139 }
117 140
118 IPC::SyncMessageFilter* sync_message_filter() const { 141 IPC::SyncMessageFilter* sync_message_filter() const {
119 return sync_message_filter_.get(); 142 return sync_message_filter_.get();
120 } 143 }
121 144
145 MessagePortBypassFilter* message_port_bypass_filter() const {
146 return message_port_bypass_filter_.get();
147 }
148
122 // The getter should only be called on the main thread, however the 149 // The getter should only be called on the main thread, however the
123 // IPC::Sender it returns may be safely called on any thread including 150 // IPC::Sender it returns may be safely called on any thread including
124 // the main thread. 151 // the main thread.
125 ThreadSafeSender* thread_safe_sender() const { 152 ThreadSafeSender* thread_safe_sender() const {
126 return thread_safe_sender_.get(); 153 return thread_safe_sender_.get();
127 } 154 }
128 155
129 ChildHistogramMessageFilter* child_histogram_message_filter() const { 156 ChildHistogramMessageFilter* child_histogram_message_filter() const {
130 return histogram_message_filter_.get(); 157 return histogram_message_filter_.get();
131 } 158 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 scoped_ptr<QuotaDispatcher> quota_dispatcher_; 252 scoped_ptr<QuotaDispatcher> quota_dispatcher_;
226 253
227 scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_; 254 scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_;
228 255
229 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_; 256 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_;
230 257
231 scoped_refptr<ServiceWorkerMessageFilter> service_worker_message_filter_; 258 scoped_refptr<ServiceWorkerMessageFilter> service_worker_message_filter_;
232 259
233 scoped_refptr<QuotaMessageFilter> quota_message_filter_; 260 scoped_refptr<QuotaMessageFilter> quota_message_filter_;
234 261
262 scoped_refptr<MessagePortBypassFilter> message_port_bypass_filter_;
263
235 scoped_ptr<ChildSharedBitmapManager> shared_bitmap_manager_; 264 scoped_ptr<ChildSharedBitmapManager> shared_bitmap_manager_;
236 265
237 base::WeakPtrFactory<ChildThread> channel_connected_factory_; 266 base::WeakPtrFactory<ChildThread> channel_connected_factory_;
238 267
239 // Observes the trace event system. When tracing is enabled, optionally 268 // Observes the trace event system. When tracing is enabled, optionally
240 // starts profiling the tcmalloc heap. 269 // starts profiling the tcmalloc heap.
241 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; 270 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_;
242 271
243 scoped_ptr<base::PowerMonitor> power_monitor_; 272 scoped_ptr<base::PowerMonitor> power_monitor_;
244 273
245 bool in_browser_process_; 274 bool in_browser_process_;
246 275
247 DISALLOW_COPY_AND_ASSIGN(ChildThread); 276 DISALLOW_COPY_AND_ASSIGN(ChildThread);
248 }; 277 };
249 278
250 } // namespace content 279 } // namespace content
251 280
252 #endif // CONTENT_CHILD_CHILD_THREAD_H_ 281 #endif // CONTENT_CHILD_CHILD_THREAD_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698