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_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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace IPC { | 23 namespace IPC { |
24 class SyncChannel; | 24 class SyncChannel; |
25 class SyncMessageFilter; | 25 class SyncMessageFilter; |
26 } | 26 } |
27 | 27 |
28 namespace WebKit { | 28 namespace WebKit { |
29 class WebFrame; | 29 class WebFrame; |
30 } | 30 } |
31 | 31 |
32 // The main thread of a child process derives from this class. | 32 // The main thread of a child process derives from this class. |
33 class CONTENT_EXPORT ChildThread : public IPC::Channel::Listener, | 33 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { |
34 public IPC::Message::Sender { | |
35 public: | 34 public: |
36 // Creates the thread. | 35 // Creates the thread. |
37 ChildThread(); | 36 ChildThread(); |
38 // Used for single-process mode. | 37 // Used for single-process mode. |
39 explicit ChildThread(const std::string& channel_name); | 38 explicit ChildThread(const std::string& channel_name); |
40 virtual ~ChildThread(); | 39 virtual ~ChildThread(); |
41 | 40 |
42 // IPC::Message::Sender implementation: | 41 // IPC::Sender implementation: |
43 virtual bool Send(IPC::Message* msg) OVERRIDE; | 42 virtual bool Send(IPC::Message* msg) OVERRIDE; |
44 | 43 |
45 // See documentation on MessageRouter for AddRoute and RemoveRoute | 44 // See documentation on MessageRouter for AddRoute and RemoveRoute |
46 void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); | 45 void AddRoute(int32 routing_id, IPC::Listener* listener); |
47 void RemoveRoute(int32 routing_id); | 46 void RemoveRoute(int32 routing_id); |
48 | 47 |
49 IPC::Channel::Listener* ResolveRoute(int32 routing_id); | 48 IPC::Listener* ResolveRoute(int32 routing_id); |
50 | 49 |
51 IPC::SyncChannel* channel() { return channel_.get(); } | 50 IPC::SyncChannel* channel() { return channel_.get(); } |
52 | 51 |
53 // Creates a ResourceLoaderBridge. | 52 // Creates a ResourceLoaderBridge. |
54 // Tests can override this method if they want a custom loading behavior. | 53 // Tests can override this method if they want a custom loading behavior. |
55 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( | 54 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( |
56 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); | 55 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); |
57 | 56 |
58 // Allocates a block of shared memory of the given size and | 57 // Allocates a block of shared memory of the given size and |
59 // maps in into the address space. Returns NULL of failure. | 58 // maps in into the address space. Returns NULL of failure. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 103 |
105 virtual void OnDumpHandles(); | 104 virtual void OnDumpHandles(); |
106 | 105 |
107 void set_on_channel_error_called(bool on_channel_error_called) { | 106 void set_on_channel_error_called(bool on_channel_error_called) { |
108 on_channel_error_called_ = on_channel_error_called; | 107 on_channel_error_called_ = on_channel_error_called; |
109 } | 108 } |
110 | 109 |
111 private: | 110 private: |
112 void Init(); | 111 void Init(); |
113 | 112 |
114 // IPC::Channel::Listener implementation: | 113 // IPC::Listener implementation: |
115 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 114 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
116 virtual void OnChannelError() OVERRIDE; | 115 virtual void OnChannelError() OVERRIDE; |
117 | 116 |
118 #if defined(USE_TCMALLOC) | 117 #if defined(USE_TCMALLOC) |
119 void OnGetTcmallocStats(); | 118 void OnGetTcmallocStats(); |
120 #endif | 119 #endif |
121 | 120 |
122 std::string channel_name_; | 121 std::string channel_name_; |
123 scoped_ptr<IPC::SyncChannel> channel_; | 122 scoped_ptr<IPC::SyncChannel> channel_; |
124 | 123 |
(...skipping 16 matching lines...) Expand all Loading... |
141 MessageLoop* message_loop_; | 140 MessageLoop* message_loop_; |
142 | 141 |
143 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; | 142 scoped_ptr<FileSystemDispatcher> file_system_dispatcher_; |
144 | 143 |
145 scoped_ptr<QuotaDispatcher> quota_dispatcher_; | 144 scoped_ptr<QuotaDispatcher> quota_dispatcher_; |
146 | 145 |
147 DISALLOW_COPY_AND_ASSIGN(ChildThread); | 146 DISALLOW_COPY_AND_ASSIGN(ChildThread); |
148 }; | 147 }; |
149 | 148 |
150 #endif // CONTENT_COMMON_CHILD_THREAD_H_ | 149 #endif // CONTENT_COMMON_CHILD_THREAD_H_ |
OLD | NEW |