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

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

Issue 1461243002: [OLD ATTEMPT, DO NOT REVIEW] mustash: Enable connections to mus from the Chrome renderer Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Invert connection creation flow. Needs lots of work. Created 5 years 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
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_IMPL_H_ 5 #ifndef CONTENT_CHILD_CHILD_THREAD_IMPL_H_
6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_H_ 6 #define CONTENT_CHILD_CHILD_THREAD_IMPL_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/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/tracked_objects.h" 16 #include "base/tracked_objects.h"
17 #include "components/mus/public/interfaces/window_tree.mojom.h"
17 #include "content/child/mojo/mojo_application.h" 18 #include "content/child/mojo/mojo_application.h"
18 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
19 #include "content/common/message_router.h" 20 #include "content/common/message_router.h"
20 #include "content/common/mojo/channel_init.h" 21 #include "content/common/mojo/channel_init.h"
21 #include "content/public/child/child_thread.h" 22 #include "content/public/child/child_thread.h"
23 #include "content/public/common/mojo_shell_connection.h"
22 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. 24 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
23 #include "ipc/ipc_platform_file.h" 25 #include "ipc/ipc_platform_file.h"
26 #include "mojo/application/public/cpp/interface_factory.h"
24 27
25 namespace base { 28 namespace base {
26 class MessageLoop; 29 class MessageLoop;
27 30
28 namespace trace_event { 31 namespace trace_event {
29 class TraceMemoryController; 32 class TraceMemoryController;
30 } // namespace trace_event 33 } // namespace trace_event
31 } // namespace base 34 } // namespace base
32 35
33 namespace IPC { 36 namespace IPC {
(...skipping 23 matching lines...) Expand all
57 class QuotaDispatcher; 60 class QuotaDispatcher;
58 class QuotaMessageFilter; 61 class QuotaMessageFilter;
59 class ResourceDispatcher; 62 class ResourceDispatcher;
60 class ThreadSafeSender; 63 class ThreadSafeSender;
61 class WebSocketDispatcher; 64 class WebSocketDispatcher;
62 struct RequestInfo; 65 struct RequestInfo;
63 66
64 // The main thread of a child process derives from this class. 67 // The main thread of a child process derives from this class.
65 class CONTENT_EXPORT ChildThreadImpl 68 class CONTENT_EXPORT ChildThreadImpl
66 : public IPC::Listener, 69 : public IPC::Listener,
70 public MojoShellConnection::Listener,
71 public mojo::InterfaceFactory<mus::mojom::WindowTreeClient>,
67 virtual public ChildThread { 72 virtual public ChildThread {
68 public: 73 public:
69 struct CONTENT_EXPORT Options; 74 struct CONTENT_EXPORT Options;
70 75
71 // Creates the thread. 76 // Creates the thread.
72 ChildThreadImpl(); 77 ChildThreadImpl();
73 // Allow to be used for single-process mode and for in process gpu mode via 78 // Allow to be used for single-process mode and for in process gpu mode via
74 // options. 79 // options.
75 explicit ChildThreadImpl(const Options& options); 80 explicit ChildThreadImpl(const Options& options);
76 // ChildProcess::main_thread() is reset after Shutdown(), and before the 81 // ChildProcess::main_thread() is reset after Shutdown(), and before the
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 201
197 void set_on_channel_error_called(bool on_channel_error_called) { 202 void set_on_channel_error_called(bool on_channel_error_called) {
198 on_channel_error_called_ = on_channel_error_called; 203 on_channel_error_called_ = on_channel_error_called;
199 } 204 }
200 205
201 // IPC::Listener implementation: 206 // IPC::Listener implementation:
202 bool OnMessageReceived(const IPC::Message& msg) override; 207 bool OnMessageReceived(const IPC::Message& msg) override;
203 void OnChannelConnected(int32 peer_pid) override; 208 void OnChannelConnected(int32 peer_pid) override;
204 void OnChannelError() override; 209 void OnChannelError() override;
205 210
211 // MojoShellConnection::Listener implementation:
212 bool ConfigureIncomingConnection(
213 mojo::ApplicationConnection* connection) override;
214
215 // mojo::InterfaceFactory<mojom::WindowTreeClient> implementation.
216 void Create(
217 mojo::ApplicationConnection* connection,
218 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override;
219
206 bool IsInBrowserProcess() const; 220 bool IsInBrowserProcess() const;
207 scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner(); 221 scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner();
208 222
209 private: 223 private:
210 class ChildThreadMessageRouter : public MessageRouter { 224 class ChildThreadMessageRouter : public MessageRouter {
211 public: 225 public:
212 // |sender| must outlive this object. 226 // |sender| must outlive this object.
213 explicit ChildThreadMessageRouter(IPC::Sender* sender); 227 explicit ChildThreadMessageRouter(IPC::Sender* sender);
214 bool Send(IPC::Message* msg) override; 228 bool Send(IPC::Message* msg) override;
215 229
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 348
335 private: 349 private:
336 struct Options options_; 350 struct Options options_;
337 351
338 DISALLOW_COPY_AND_ASSIGN(Builder); 352 DISALLOW_COPY_AND_ASSIGN(Builder);
339 }; 353 };
340 354
341 } // namespace content 355 } // namespace content
342 356
343 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ 357 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698