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

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

Issue 382333002: Introduce ChannelMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed ChanelBuilder to ChannelFactory Created 6 years, 5 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
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 class QuotaMessageFilter; 50 class QuotaMessageFilter;
51 class ResourceDispatcher; 51 class ResourceDispatcher;
52 class SocketStreamDispatcher; 52 class SocketStreamDispatcher;
53 class ThreadSafeSender; 53 class ThreadSafeSender;
54 class WebSocketDispatcher; 54 class WebSocketDispatcher;
55 struct RequestInfo; 55 struct RequestInfo;
56 56
57 // The main thread of a child process derives from this class. 57 // The main thread of a child process derives from this class.
58 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { 58 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
59 public: 59 public:
60 struct CONTENT_EXPORT InitOptions {
darin (slow to review) 2014/07/23 23:03:33 nit: You could probably just call this Options, wh
Hajime Morrita 2014/07/24 00:38:44 Done.
61 explicit InitOptions(std::string name = "", bool mojo = false)
darin (slow to review) 2014/07/23 23:03:33 nit: Google C++ style recommends against using def
Hajime Morrita 2014/07/24 00:38:44 Done. I should re-read the coding guideline to unl
62 : channel_name(name), use_mojo_channel(mojo) {}
63
64 std::string channel_name;
65 bool use_mojo_channel;
66 };
67
60 // Creates the thread. 68 // Creates the thread.
61 ChildThread(); 69 ChildThread();
62 // Used for single-process mode and for in process gpu mode. 70 // Used for single-process mode and for in process gpu mode.
63 explicit ChildThread(const std::string& channel_name); 71 explicit ChildThread(const InitOptions& options);
64 // ChildProcess::main_thread() is reset after Shutdown(), and before the 72 // ChildProcess::main_thread() is reset after Shutdown(), and before the
65 // destructor, so any subsystem that relies on ChildProcess::main_thread() 73 // destructor, so any subsystem that relies on ChildProcess::main_thread()
66 // must be terminated before Shutdown returns. In particular, if a subsystem 74 // must be terminated before Shutdown returns. In particular, if a subsystem
67 // has a thread that post tasks to ChildProcess::main_thread(), that thread 75 // has a thread that post tasks to ChildProcess::main_thread(), that thread
68 // should be joined in Shutdown(). 76 // should be joined in Shutdown().
69 virtual ~ChildThread(); 77 virtual ~ChildThread();
70 virtual void Shutdown(); 78 virtual void Shutdown();
71 79
72 // IPC::Sender implementation: 80 // IPC::Sender implementation:
73 virtual bool Send(IPC::Message* msg) OVERRIDE; 81 virtual bool Send(IPC::Message* msg) OVERRIDE;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 class ChildThreadMessageRouter : public MessageRouter { 182 class ChildThreadMessageRouter : public MessageRouter {
175 public: 183 public:
176 // |sender| must outlive this object. 184 // |sender| must outlive this object.
177 explicit ChildThreadMessageRouter(IPC::Sender* sender); 185 explicit ChildThreadMessageRouter(IPC::Sender* sender);
178 virtual bool Send(IPC::Message* msg) OVERRIDE; 186 virtual bool Send(IPC::Message* msg) OVERRIDE;
179 187
180 private: 188 private:
181 IPC::Sender* const sender_; 189 IPC::Sender* const sender_;
182 }; 190 };
183 191
184 void Init(); 192 void Init(const InitOptions& options);
193 scoped_ptr<IPC::SyncChannel> CreateChannel(bool use_mojo_channel);
185 194
186 // IPC message handlers. 195 // IPC message handlers.
187 void OnShutdown(); 196 void OnShutdown();
188 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status); 197 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status);
189 void OnGetChildProfilerData(int sequence_number); 198 void OnGetChildProfilerData(int sequence_number);
190 void OnDumpHandles(); 199 void OnDumpHandles();
191 void OnProcessBackgrounded(bool background); 200 void OnProcessBackgrounded(bool background);
192 #ifdef IPC_MESSAGE_LOG_ENABLED 201 #ifdef IPC_MESSAGE_LOG_ENABLED
193 void OnSetIPCLoggingEnabled(bool enable); 202 void OnSetIPCLoggingEnabled(bool enable);
194 #endif 203 #endif
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 scoped_ptr<base::PowerMonitor> power_monitor_; 259 scoped_ptr<base::PowerMonitor> power_monitor_;
251 260
252 bool in_browser_process_; 261 bool in_browser_process_;
253 262
254 DISALLOW_COPY_AND_ASSIGN(ChildThread); 263 DISALLOW_COPY_AND_ASSIGN(ChildThread);
255 }; 264 };
256 265
257 } // namespace content 266 } // namespace content
258 267
259 #endif // CONTENT_CHILD_CHILD_THREAD_H_ 268 #endif // CONTENT_CHILD_CHILD_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698