OLD | NEW |
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> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "base/power_monitor/power_monitor.h" | 14 #include "base/power_monitor/power_monitor.h" |
13 #include "base/tracked_objects.h" | 15 #include "base/tracked_objects.h" |
14 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
15 #include "content/common/message_router.h" | 17 #include "content/common/message_router.h" |
16 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. | 18 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. |
17 #include "webkit/child/resource_loader_bridge.h" | 19 #include "webkit/child/resource_loader_bridge.h" |
(...skipping 12 matching lines...) Expand all Loading... |
30 } // namespace IPC | 32 } // namespace IPC |
31 | 33 |
32 namespace WebKit { | 34 namespace WebKit { |
33 class WebFrame; | 35 class WebFrame; |
34 } // namespace WebKit | 36 } // namespace WebKit |
35 | 37 |
36 namespace content { | 38 namespace content { |
37 class ChildHistogramMessageFilter; | 39 class ChildHistogramMessageFilter; |
38 class ChildResourceMessageFilter; | 40 class ChildResourceMessageFilter; |
39 class FileSystemDispatcher; | 41 class FileSystemDispatcher; |
| 42 class ServiceWorkerDispatcher; |
| 43 class ServiceWorkerMessageFilter; |
40 class QuotaDispatcher; | 44 class QuotaDispatcher; |
41 class QuotaMessageFilter; | 45 class QuotaMessageFilter; |
42 class ResourceDispatcher; | 46 class ResourceDispatcher; |
43 class SocketStreamDispatcher; | 47 class SocketStreamDispatcher; |
44 class ThreadSafeSender; | 48 class ThreadSafeSender; |
45 class WebSocketDispatcher; | 49 class WebSocketDispatcher; |
46 | 50 |
47 // The main thread of a child process derives from this class. | 51 // The main thread of a child process derives from this class. |
48 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { | 52 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { |
49 public: | 53 public: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 97 } |
94 | 98 |
95 WebSocketDispatcher* websocket_dispatcher() const { | 99 WebSocketDispatcher* websocket_dispatcher() const { |
96 return websocket_dispatcher_.get(); | 100 return websocket_dispatcher_.get(); |
97 } | 101 } |
98 | 102 |
99 FileSystemDispatcher* file_system_dispatcher() const { | 103 FileSystemDispatcher* file_system_dispatcher() const { |
100 return file_system_dispatcher_.get(); | 104 return file_system_dispatcher_.get(); |
101 } | 105 } |
102 | 106 |
| 107 ServiceWorkerDispatcher* service_worker_dispatcher() const { |
| 108 return service_worker_dispatcher_.get(); |
| 109 } |
| 110 |
103 QuotaDispatcher* quota_dispatcher() const { | 111 QuotaDispatcher* quota_dispatcher() const { |
104 return quota_dispatcher_.get(); | 112 return quota_dispatcher_.get(); |
105 } | 113 } |
106 | 114 |
107 IPC::SyncMessageFilter* sync_message_filter() const { | 115 IPC::SyncMessageFilter* sync_message_filter() const { |
108 return sync_message_filter_.get(); | 116 return sync_message_filter_.get(); |
109 } | 117 } |
110 | 118 |
111 // The getter should only be called on the main thread, however the | 119 // The getter should only be called on the main thread, however the |
112 // IPC::Sender it returns may be safely called on any thread including | 120 // IPC::Sender it returns may be safely called on any thread including |
113 // the main thread. | 121 // the main thread. |
114 ThreadSafeSender* thread_safe_sender() const { | 122 ThreadSafeSender* thread_safe_sender() const { |
115 return thread_safe_sender_.get(); | 123 return thread_safe_sender_.get(); |
116 } | 124 } |
117 | 125 |
118 ChildHistogramMessageFilter* child_histogram_message_filter() const { | 126 ChildHistogramMessageFilter* child_histogram_message_filter() const { |
119 return histogram_message_filter_.get(); | 127 return histogram_message_filter_.get(); |
120 } | 128 } |
121 | 129 |
| 130 ServiceWorkerMessageFilter* service_worker_message_filter() const { |
| 131 return service_worker_message_filter_.get(); |
| 132 } |
| 133 |
122 QuotaMessageFilter* quota_message_filter() const { | 134 QuotaMessageFilter* quota_message_filter() const { |
123 return quota_message_filter_.get(); | 135 return quota_message_filter_.get(); |
124 } | 136 } |
125 | 137 |
126 base::MessageLoop* message_loop() const { return message_loop_; } | 138 base::MessageLoop* message_loop() const { return message_loop_; } |
127 | 139 |
128 // Returns the one child thread. Can only be called on the main thread. | 140 // Returns the one child thread. Can only be called on the main thread. |
129 static ChildThread* current(); | 141 static ChildThread* current(); |
130 | 142 |
131 #if defined(OS_ANDROID) | 143 #if defined(OS_ANDROID) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 scoped_ptr<WebSocketDispatcher> websocket_dispatcher_; | 200 scoped_ptr<WebSocketDispatcher> websocket_dispatcher_; |
189 | 201 |
190 // The OnChannelError() callback was invoked - the channel is dead, don't | 202 // The OnChannelError() callback was invoked - the channel is dead, don't |
191 // attempt to communicate. | 203 // attempt to communicate. |
192 bool on_channel_error_called_; | 204 bool on_channel_error_called_; |
193 | 205 |
194 base::MessageLoop* message_loop_; | 206 base::MessageLoop* message_loop_; |
195 | 207 |
196 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; | 208 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; |
197 | 209 |
| 210 scoped_ptr<ServiceWorkerDispatcher> service_worker_dispatcher_; |
| 211 |
198 scoped_ptr<QuotaDispatcher> quota_dispatcher_; | 212 scoped_ptr<QuotaDispatcher> quota_dispatcher_; |
199 | 213 |
200 scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_; | 214 scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_; |
201 | 215 |
202 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_; | 216 scoped_refptr<ChildResourceMessageFilter> resource_message_filter_; |
203 | 217 |
| 218 scoped_refptr<ServiceWorkerMessageFilter> service_worker_message_filter_; |
| 219 |
204 scoped_refptr<QuotaMessageFilter> quota_message_filter_; | 220 scoped_refptr<QuotaMessageFilter> quota_message_filter_; |
205 | 221 |
206 base::WeakPtrFactory<ChildThread> channel_connected_factory_; | 222 base::WeakPtrFactory<ChildThread> channel_connected_factory_; |
207 | 223 |
208 // Observes the trace event system. When tracing is enabled, optionally | 224 // Observes the trace event system. When tracing is enabled, optionally |
209 // starts profiling the tcmalloc heap. | 225 // starts profiling the tcmalloc heap. |
210 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; | 226 scoped_ptr<base::debug::TraceMemoryController> trace_memory_controller_; |
211 | 227 |
212 scoped_ptr<base::PowerMonitor> power_monitor_; | 228 scoped_ptr<base::PowerMonitor> power_monitor_; |
213 | 229 |
214 bool in_browser_process_; | 230 bool in_browser_process_; |
215 | 231 |
216 DISALLOW_COPY_AND_ASSIGN(ChildThread); | 232 DISALLOW_COPY_AND_ASSIGN(ChildThread); |
217 }; | 233 }; |
218 | 234 |
219 } // namespace content | 235 } // namespace content |
220 | 236 |
221 #endif // CONTENT_CHILD_CHILD_THREAD_H_ | 237 #endif // CONTENT_CHILD_CHILD_THREAD_H_ |
OLD | NEW |