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

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

Issue 198073003: Remove some content_child dependency from content_common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ffd442cb fix for bots barfing on clang style checks 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 | Annotate | Revision Log
« 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"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // destructor, so any subsystem that relies on ChildProcess::main_thread() 59 // destructor, so any subsystem that relies on ChildProcess::main_thread()
60 // must be terminated before Shutdown returns. In particular, if a subsystem 60 // must be terminated before Shutdown returns. In particular, if a subsystem
61 // 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
62 // should be joined in Shutdown(). 62 // should be joined in Shutdown().
63 virtual ~ChildThread(); 63 virtual ~ChildThread();
64 virtual void Shutdown(); 64 virtual void Shutdown();
65 65
66 // IPC::Sender implementation: 66 // IPC::Sender implementation:
67 virtual bool Send(IPC::Message* msg) OVERRIDE; 67 virtual bool Send(IPC::Message* msg) OVERRIDE;
68 68
69 // See documentation on MessageRouter for AddRoute and RemoveRoute 69 IPC::SyncChannel* channel() { return channel_.get(); }
70 void AddRoute(int32 routing_id, IPC::Listener* listener);
71 void RemoveRoute(int32 routing_id);
72 70
73 IPC::SyncChannel* channel() { return channel_.get(); } 71 MessageRouter* GetRouter();
74 72
75 // Creates a ResourceLoaderBridge. 73 // Creates a ResourceLoaderBridge.
76 // Tests can override this method if they want a custom loading behavior. 74 // Tests can override this method if they want a custom loading behavior.
77 virtual webkit_glue::ResourceLoaderBridge* CreateBridge( 75 virtual webkit_glue::ResourceLoaderBridge* CreateBridge(
78 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info); 76 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info);
79 77
80 // Allocates a block of shared memory of the given size and 78 // Allocates a block of shared memory of the given size and
81 // maps in into the address space. Returns NULL of failure. 79 // maps in into the address space. Returns NULL of failure.
82 // Note: On posix, this requires a sync IPC to the browser process, 80 // Note: On posix, this requires a sync IPC to the browser process,
83 // but on windows the child process directly allocates the block. 81 // but on windows the child process directly allocates the block.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 void set_on_channel_error_called(bool on_channel_error_called) { 155 void set_on_channel_error_called(bool on_channel_error_called) {
158 on_channel_error_called_ = on_channel_error_called; 156 on_channel_error_called_ = on_channel_error_called;
159 } 157 }
160 158
161 // IPC::Listener implementation: 159 // IPC::Listener implementation:
162 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 160 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
163 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 161 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
164 virtual void OnChannelError() OVERRIDE; 162 virtual void OnChannelError() OVERRIDE;
165 163
166 private: 164 private:
165 class ChildThreadMessageRouter : public MessageRouter {
166 public:
167 // |sender| must outlive this object.
168 explicit ChildThreadMessageRouter(IPC::Sender* sender);
169 virtual bool Send(IPC::Message* msg) OVERRIDE;
170
171 private:
172 IPC::Sender* const sender_;
173 };
174
167 void Init(); 175 void Init();
168 176
169 // IPC message handlers. 177 // IPC message handlers.
170 void OnShutdown(); 178 void OnShutdown();
171 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status); 179 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status);
172 void OnGetChildProfilerData(int sequence_number); 180 void OnGetChildProfilerData(int sequence_number);
173 void OnDumpHandles(); 181 void OnDumpHandles();
174 #ifdef IPC_MESSAGE_LOG_ENABLED 182 #ifdef IPC_MESSAGE_LOG_ENABLED
175 void OnSetIPCLoggingEnabled(bool enable); 183 void OnSetIPCLoggingEnabled(bool enable);
176 #endif 184 #endif
177 #if defined(USE_TCMALLOC) 185 #if defined(USE_TCMALLOC)
178 void OnGetTcmallocStats(); 186 void OnGetTcmallocStats();
179 #endif 187 #endif
180 188
181 void EnsureConnected(); 189 void EnsureConnected();
182 190
183 std::string channel_name_; 191 std::string channel_name_;
184 scoped_ptr<IPC::SyncChannel> channel_; 192 scoped_ptr<IPC::SyncChannel> channel_;
185 193
186 // Allows threads other than the main thread to send sync messages. 194 // Allows threads other than the main thread to send sync messages.
187 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; 195 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
188 196
189 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 197 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
190 198
191 // Implements message routing functionality to the consumers of ChildThread. 199 // Implements message routing functionality to the consumers of ChildThread.
192 MessageRouter router_; 200 ChildThreadMessageRouter router_;
193 201
194 // Handles resource loads for this process. 202 // Handles resource loads for this process.
195 scoped_ptr<ResourceDispatcher> resource_dispatcher_; 203 scoped_ptr<ResourceDispatcher> resource_dispatcher_;
196 204
197 // Handles SocketStream for this process. 205 // Handles SocketStream for this process.
198 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_; 206 scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_;
199 207
200 scoped_ptr<WebSocketDispatcher> websocket_dispatcher_; 208 scoped_ptr<WebSocketDispatcher> websocket_dispatcher_;
201 209
202 // The OnChannelError() callback was invoked - the channel is dead, don't 210 // The OnChannelError() callback was invoked - the channel is dead, don't
(...skipping 25 matching lines...) Expand all
228 scoped_ptr<base::PowerMonitor> power_monitor_; 236 scoped_ptr<base::PowerMonitor> power_monitor_;
229 237
230 bool in_browser_process_; 238 bool in_browser_process_;
231 239
232 DISALLOW_COPY_AND_ASSIGN(ChildThread); 240 DISALLOW_COPY_AND_ASSIGN(ChildThread);
233 }; 241 };
234 242
235 } // namespace content 243 } // namespace content
236 244
237 #endif // CONTENT_CHILD_CHILD_THREAD_H_ 245 #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