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> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 namespace IPC { | 28 namespace IPC { |
29 class SyncChannel; | 29 class SyncChannel; |
30 class SyncMessageFilter; | 30 class SyncMessageFilter; |
31 } // namespace IPC | 31 } // namespace IPC |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 class WebFrame; | 34 class WebFrame; |
35 } // namespace blink | 35 } // namespace blink |
36 | 36 |
37 namespace webkit_glue { | |
38 class ResourceLoaderBridge; | |
39 } // namespace webkit_glue | |
40 | |
41 namespace content { | 37 namespace content { |
42 class ChildHistogramMessageFilter; | 38 class ChildHistogramMessageFilter; |
43 class ChildResourceMessageFilter; | 39 class ChildResourceMessageFilter; |
44 class ChildSharedBitmapManager; | 40 class ChildSharedBitmapManager; |
45 class FileSystemDispatcher; | 41 class FileSystemDispatcher; |
46 class ServiceWorkerDispatcher; | 42 class ServiceWorkerDispatcher; |
47 class ServiceWorkerMessageFilter; | 43 class ServiceWorkerMessageFilter; |
48 class QuotaDispatcher; | 44 class QuotaDispatcher; |
49 class QuotaMessageFilter; | 45 class QuotaMessageFilter; |
50 class ResourceDispatcher; | 46 class ResourceDispatcher; |
51 class SocketStreamDispatcher; | 47 class SocketStreamDispatcher; |
52 class ThreadSafeSender; | 48 class ThreadSafeSender; |
53 class WebSocketDispatcher; | 49 class WebSocketDispatcher; |
54 struct RequestInfo; | |
55 | 50 |
56 // The main thread of a child process derives from this class. | 51 // The main thread of a child process derives from this class. |
57 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { | 52 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { |
58 public: | 53 public: |
59 // Creates the thread. | 54 // Creates the thread. |
60 ChildThread(); | 55 ChildThread(); |
61 // Used for single-process mode and for in process gpu mode. | 56 // Used for single-process mode and for in process gpu mode. |
62 explicit ChildThread(const std::string& channel_name); | 57 explicit ChildThread(const std::string& channel_name); |
63 // ChildProcess::main_thread() is reset after Shutdown(), and before the | 58 // ChildProcess::main_thread() is reset after Shutdown(), and before the |
64 // destructor, so any subsystem that relies on ChildProcess::main_thread() | 59 // destructor, so any subsystem that relies on ChildProcess::main_thread() |
65 // must be terminated before Shutdown returns. In particular, if a subsystem | 60 // must be terminated before Shutdown returns. In particular, if a subsystem |
66 // has a thread that post tasks to ChildProcess::main_thread(), that thread | 61 // has a thread that post tasks to ChildProcess::main_thread(), that thread |
67 // should be joined in Shutdown(). | 62 // should be joined in Shutdown(). |
68 virtual ~ChildThread(); | 63 virtual ~ChildThread(); |
69 virtual void Shutdown(); | 64 virtual void Shutdown(); |
70 | 65 |
71 // IPC::Sender implementation: | 66 // IPC::Sender implementation: |
72 virtual bool Send(IPC::Message* msg) OVERRIDE; | 67 virtual bool Send(IPC::Message* msg) OVERRIDE; |
73 | 68 |
74 IPC::SyncChannel* channel() { return channel_.get(); } | 69 IPC::SyncChannel* channel() { return channel_.get(); } |
75 | 70 |
76 MessageRouter* GetRouter(); | 71 MessageRouter* GetRouter(); |
77 | 72 |
78 // Creates a ResourceLoaderBridge. | |
79 // Tests can override this method if they want a custom loading behavior. | |
80 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( | |
81 const RequestInfo& request_info); | |
82 | |
83 // Allocates a block of shared memory of the given size and | 73 // Allocates a block of shared memory of the given size and |
84 // maps in into the address space. Returns NULL of failure. | 74 // maps in into the address space. Returns NULL of failure. |
85 // Note: On posix, this requires a sync IPC to the browser process, | 75 // Note: On posix, this requires a sync IPC to the browser process, |
86 // but on windows the child process directly allocates the block. | 76 // but on windows the child process directly allocates the block. |
87 base::SharedMemory* AllocateSharedMemory(size_t buf_size); | 77 base::SharedMemory* AllocateSharedMemory(size_t buf_size); |
88 | 78 |
89 // A static variant that can be called on background threads provided | 79 // A static variant that can be called on background threads provided |
90 // the |sender| passed in is safe to use on background threads. | 80 // the |sender| passed in is safe to use on background threads. |
91 static base::SharedMemory* AllocateSharedMemory(size_t buf_size, | 81 static base::SharedMemory* AllocateSharedMemory(size_t buf_size, |
92 IPC::Sender* sender); | 82 IPC::Sender* sender); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 scoped_ptr<base::PowerMonitor> power_monitor_; | 237 scoped_ptr<base::PowerMonitor> power_monitor_; |
248 | 238 |
249 bool in_browser_process_; | 239 bool in_browser_process_; |
250 | 240 |
251 DISALLOW_COPY_AND_ASSIGN(ChildThread); | 241 DISALLOW_COPY_AND_ASSIGN(ChildThread); |
252 }; | 242 }; |
253 | 243 |
254 } // namespace content | 244 } // namespace content |
255 | 245 |
256 #endif // CONTENT_CHILD_CHILD_THREAD_H_ | 246 #endif // CONTENT_CHILD_CHILD_THREAD_H_ |
OLD | NEW |