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

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

Issue 352013002: Revert 279557 "Support exposing Mojo services between render fra..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
« no previous file with comments | « trunk/src/content/child/BUILD.gn ('k') | trunk/src/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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/power_monitor/power_monitor.h" 14 #include "base/power_monitor/power_monitor.h"
15 #include "base/tracked_objects.h" 15 #include "base/tracked_objects.h"
16 #include "content/child/mojo/mojo_application.h"
17 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
18 #include "content/common/message_router.h" 17 #include "content/common/message_router.h"
19 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. 18 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
19 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
20 20
21 namespace base { 21 namespace base {
22 class MessageLoop; 22 class MessageLoop;
23 23
24 namespace debug { 24 namespace debug {
25 class TraceMemoryController; 25 class TraceMemoryController;
26 } // namespace debug 26 } // namespace debug
27 } // namespace base 27 } // namespace base
28 28
29 namespace IPC { 29 namespace IPC {
30 class SyncChannel; 30 class SyncChannel;
31 class SyncMessageFilter; 31 class SyncMessageFilter;
32 } // namespace IPC 32 } // namespace IPC
33 33
34 namespace blink { 34 namespace blink {
35 class WebFrame; 35 class WebFrame;
36 } // namespace blink 36 } // namespace blink
37 37
38 namespace webkit_glue { 38 namespace webkit_glue {
39 class ResourceLoaderBridge; 39 class ResourceLoaderBridge;
40 } // namespace webkit_glue 40 } // namespace webkit_glue
41 41
42 namespace content { 42 namespace content {
43 class ChildHistogramMessageFilter; 43 class ChildHistogramMessageFilter;
44 class ChildResourceMessageFilter; 44 class ChildResourceMessageFilter;
45 class ChildSharedBitmapManager; 45 class ChildSharedBitmapManager;
46 class FileSystemDispatcher; 46 class FileSystemDispatcher;
47 class MojoApplication;
47 class ServiceWorkerDispatcher; 48 class ServiceWorkerDispatcher;
48 class ServiceWorkerMessageFilter; 49 class ServiceWorkerMessageFilter;
49 class QuotaDispatcher; 50 class QuotaDispatcher;
50 class QuotaMessageFilter; 51 class QuotaMessageFilter;
51 class ResourceDispatcher; 52 class ResourceDispatcher;
52 class SocketStreamDispatcher; 53 class SocketStreamDispatcher;
53 class ThreadSafeSender; 54 class ThreadSafeSender;
54 class WebSocketDispatcher; 55 class WebSocketDispatcher;
55 struct RequestInfo; 56 struct RequestInfo;
56 57
57 // The main thread of a child process derives from this class. 58 // The main thread of a child process derives from this class.
58 class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender { 59 class CONTENT_EXPORT ChildThread
60 : public IPC::Listener,
61 public IPC::Sender,
62 public NON_EXPORTED_BASE(mojo::ServiceProvider) {
59 public: 63 public:
60 // Creates the thread. 64 // Creates the thread.
61 ChildThread(); 65 ChildThread();
62 // Used for single-process mode and for in process gpu mode. 66 // Used for single-process mode and for in process gpu mode.
63 explicit ChildThread(const std::string& channel_name); 67 explicit ChildThread(const std::string& channel_name);
64 // ChildProcess::main_thread() is reset after Shutdown(), and before the 68 // ChildProcess::main_thread() is reset after Shutdown(), and before the
65 // destructor, so any subsystem that relies on ChildProcess::main_thread() 69 // destructor, so any subsystem that relies on ChildProcess::main_thread()
66 // must be terminated before Shutdown returns. In particular, if a subsystem 70 // must be terminated before Shutdown returns. In particular, if a subsystem
67 // has a thread that post tasks to ChildProcess::main_thread(), that thread 71 // has a thread that post tasks to ChildProcess::main_thread(), that thread
68 // should be joined in Shutdown(). 72 // should be joined in Shutdown().
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 146
143 // Returns the one child thread. Can only be called on the main thread. 147 // Returns the one child thread. Can only be called on the main thread.
144 static ChildThread* current(); 148 static ChildThread* current();
145 149
146 #if defined(OS_ANDROID) 150 #if defined(OS_ANDROID)
147 // Called on Android's service thread to shutdown the main thread of this 151 // Called on Android's service thread to shutdown the main thread of this
148 // process. 152 // process.
149 static void ShutdownThread(); 153 static void ShutdownThread();
150 #endif 154 #endif
151 155
152 ServiceRegistry* service_registry() const {
153 return mojo_application_->service_registry();
154 }
155
156 protected: 156 protected:
157 friend class ChildProcess; 157 friend class ChildProcess;
158 158
159 // Called when the process refcount is 0. 159 // Called when the process refcount is 0.
160 void OnProcessFinalRelease(); 160 void OnProcessFinalRelease();
161 161
162 virtual bool OnControlMessageReceived(const IPC::Message& msg); 162 virtual bool OnControlMessageReceived(const IPC::Message& msg);
163 163
164 void set_on_channel_error_called(bool on_channel_error_called) { 164 void set_on_channel_error_called(bool on_channel_error_called) {
165 on_channel_error_called_ = on_channel_error_called; 165 on_channel_error_called_ = on_channel_error_called;
166 } 166 }
167 167
168 // IPC::Listener implementation: 168 // IPC::Listener implementation:
169 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; 169 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
170 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 170 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
171 virtual void OnChannelError() OVERRIDE; 171 virtual void OnChannelError() OVERRIDE;
172 172
173 // mojo::ServiceProvider implementation:
174 virtual void ConnectToService(
175 const mojo::String& service_url,
176 const mojo::String& service_name,
177 mojo::ScopedMessagePipeHandle message_pipe,
178 const mojo::String& requestor_url) OVERRIDE;
179
173 private: 180 private:
174 class ChildThreadMessageRouter : public MessageRouter { 181 class ChildThreadMessageRouter : public MessageRouter {
175 public: 182 public:
176 // |sender| must outlive this object. 183 // |sender| must outlive this object.
177 explicit ChildThreadMessageRouter(IPC::Sender* sender); 184 explicit ChildThreadMessageRouter(IPC::Sender* sender);
178 virtual bool Send(IPC::Message* msg) OVERRIDE; 185 virtual bool Send(IPC::Message* msg) OVERRIDE;
179 186
180 private: 187 private:
181 IPC::Sender* const sender_; 188 IPC::Sender* const sender_;
182 }; 189 };
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 scoped_ptr<base::PowerMonitor> power_monitor_; 257 scoped_ptr<base::PowerMonitor> power_monitor_;
251 258
252 bool in_browser_process_; 259 bool in_browser_process_;
253 260
254 DISALLOW_COPY_AND_ASSIGN(ChildThread); 261 DISALLOW_COPY_AND_ASSIGN(ChildThread);
255 }; 262 };
256 263
257 } // namespace content 264 } // namespace content
258 265
259 #endif // CONTENT_CHILD_CHILD_THREAD_H_ 266 #endif // CONTENT_CHILD_CHILD_THREAD_H_
OLDNEW
« no previous file with comments | « trunk/src/content/child/BUILD.gn ('k') | trunk/src/content/child/child_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698