OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_CHILD_THREAD_H_ | 5 #ifndef CONTENT_COMMON_CHILD_THREAD_H_ |
6 #define CONTENT_COMMON_CHILD_THREAD_H_ | 6 #define CONTENT_COMMON_CHILD_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "content/common/message_router.h" | 11 #include "content/common/message_router.h" |
12 #include "webkit/glue/resource_loader_bridge.h" | 12 #include "webkit/glue/resource_loader_bridge.h" |
13 | 13 |
14 class FileSystemDispatcher; | 14 class FileSystemDispatcher; |
15 class MessageLoop; | 15 class MessageLoop; |
16 class NotificationService; | 16 class NotificationService; |
17 class QuotaDispatcher; | 17 class QuotaDispatcher; |
18 class ResourceDispatcher; | 18 class ResourceDispatcher; |
19 class SocketStreamDispatcher; | 19 class SocketStreamDispatcher; |
20 | 20 |
21 namespace IPC { | 21 namespace IPC { |
22 class SyncChannel; | 22 class SyncChannel; |
23 class OutgoingMessageFilter; | |
23 class SyncMessageFilter; | 24 class SyncMessageFilter; |
24 } | 25 } |
25 | 26 |
26 // The main thread of a child process derives from this class. | 27 // The main thread of a child process derives from this class. |
27 class ChildThread : public IPC::Channel::Listener, | 28 class ChildThread : public IPC::Channel::Listener, |
28 public IPC::Message::Sender { | 29 public IPC::Message::Sender { |
29 public: | 30 public: |
30 // Creates the thread. | 31 // Creates the thread. |
31 ChildThread(); | 32 ChildThread(); |
32 // Used for single-process mode. | 33 // Used for single-process mode. |
33 explicit ChildThread(const std::string& channel_name); | 34 explicit ChildThread(const std::string& channel_name); |
34 virtual ~ChildThread(); | 35 virtual ~ChildThread(); |
35 | 36 |
36 // IPC::Message::Sender implementation: | 37 // IPC::Message::Sender implementation: |
37 virtual bool Send(IPC::Message* msg); | 38 virtual bool Send(IPC::Message* msg); |
38 | 39 |
39 // See documentation on MessageRouter for AddRoute and RemoveRoute | 40 // See documentation on MessageRouter for AddRoute and RemoveRoute |
40 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 41 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); |
41 void RemoveRoute(int32 routing_id); | 42 void RemoveRoute(int32 routing_id); |
42 | 43 |
43 IPC::Channel::Listener* ResolveRoute(int32 routing_id); | 44 IPC::Channel::Listener* ResolveRoute(int32 routing_id); |
44 | 45 |
46 // Adds a filter to rewrite outgoing messages (used mainly for testing). | |
jam
2011/04/28 23:43:46
how about just making channel() public, it seems t
| |
47 void SetOutgoingMessageFilter(IPC::OutgoingMessageFilter* filter); | |
48 | |
45 // Creates a ResourceLoaderBridge. | 49 // Creates a ResourceLoaderBridge. |
46 // Tests can override this method if they want a custom loading behavior. | 50 // Tests can override this method if they want a custom loading behavior. |
47 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( | 51 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( |
48 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); | 52 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); |
49 | 53 |
50 ResourceDispatcher* resource_dispatcher(); | 54 ResourceDispatcher* resource_dispatcher(); |
51 | 55 |
52 SocketStreamDispatcher* socket_stream_dispatcher() { | 56 SocketStreamDispatcher* socket_stream_dispatcher() { |
53 return socket_stream_dispatcher_.get(); | 57 return socket_stream_dispatcher_.get(); |
54 } | 58 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 scoped_ptr<NotificationService> notification_service_; | 130 scoped_ptr<NotificationService> notification_service_; |
127 | 131 |
128 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; | 132 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; |
129 | 133 |
130 scoped_ptr<QuotaDispatcher> quota_dispatcher_; | 134 scoped_ptr<QuotaDispatcher> quota_dispatcher_; |
131 | 135 |
132 DISALLOW_COPY_AND_ASSIGN(ChildThread); | 136 DISALLOW_COPY_AND_ASSIGN(ChildThread); |
133 }; | 137 }; |
134 | 138 |
135 #endif // CONTENT_COMMON_CHILD_THREAD_H_ | 139 #endif // CONTENT_COMMON_CHILD_THREAD_H_ |
OLD | NEW |