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

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

Issue 2310563002: Adds routed interface support between RenderFrameHost and RenderFrame (Closed)
Patch Set: . Created 4 years, 3 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
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/power_monitor/power_monitor.h" 17 #include "base/power_monitor/power_monitor.h"
18 #include "base/sequenced_task_runner.h" 18 #include "base/sequenced_task_runner.h"
19 #include "base/tracked_objects.h" 19 #include "base/tracked_objects.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
22 #include "content/public/child/child_thread.h" 22 #include "content/public/child/child_thread.h"
23 #include "content/public/common/associated_interfaces.mojom.h"
23 #include "ipc/ipc.mojom.h" 24 #include "ipc/ipc.mojom.h"
24 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. 25 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
25 #include "ipc/ipc_platform_file.h" 26 #include "ipc/ipc_platform_file.h"
26 #include "ipc/message_router.h" 27 #include "ipc/message_router.h"
28 #include "mojo/public/cpp/bindings/associated_binding.h"
29 #include "mojo/public/cpp/bindings/associated_binding_set.h"
27 30
28 namespace base { 31 namespace base {
29 class MessageLoop; 32 class MessageLoop;
30 } // namespace base 33 } // namespace base
31 34
32 namespace IPC { 35 namespace IPC {
33 class MessageFilter; 36 class MessageFilter;
34 class SyncChannel; 37 class SyncChannel;
35 class SyncMessageFilter; 38 class SyncMessageFilter;
36 } // namespace IPC 39 } // namespace IPC
(...skipping 26 matching lines...) Expand all
63 class ServiceWorkerMessageFilter; 66 class ServiceWorkerMessageFilter;
64 class QuotaDispatcher; 67 class QuotaDispatcher;
65 class QuotaMessageFilter; 68 class QuotaMessageFilter;
66 class ResourceDispatcher; 69 class ResourceDispatcher;
67 class ThreadSafeSender; 70 class ThreadSafeSender;
68 struct RequestInfo; 71 struct RequestInfo;
69 72
70 // The main thread of a child process derives from this class. 73 // The main thread of a child process derives from this class.
71 class CONTENT_EXPORT ChildThreadImpl 74 class CONTENT_EXPORT ChildThreadImpl
72 : public IPC::Listener, 75 : public IPC::Listener,
73 virtual public ChildThread { 76 virtual public ChildThread,
77 NON_EXPORTED_BASE(public mojom::RouteProvider),
78 NON_EXPORTED_BASE(public mojom::AssociatedInterfaceProvider) {
74 public: 79 public:
75 struct CONTENT_EXPORT Options; 80 struct CONTENT_EXPORT Options;
76 81
77 // Creates the thread. 82 // Creates the thread.
78 ChildThreadImpl(); 83 ChildThreadImpl();
79 // Allow to be used for single-process mode and for in process gpu mode via 84 // Allow to be used for single-process mode and for in process gpu mode via
80 // options. 85 // options.
81 explicit ChildThreadImpl(const Options& options); 86 explicit ChildThreadImpl(const Options& options);
82 // ChildProcess::main_thread() is reset after Shutdown(), and before the 87 // ChildProcess::main_thread() is reset after Shutdown(), and before the
83 // destructor, so any subsystem that relies on ChildProcess::main_thread() 88 // destructor, so any subsystem that relies on ChildProcess::main_thread()
(...skipping 10 matching lines...) Expand all
94 // ChildThread implementation: 99 // ChildThread implementation:
95 #if defined(OS_WIN) 100 #if defined(OS_WIN)
96 void PreCacheFont(const LOGFONT& log_font) override; 101 void PreCacheFont(const LOGFONT& log_font) override;
97 void ReleaseCachedFonts() override; 102 void ReleaseCachedFonts() override;
98 #endif 103 #endif
99 void RecordAction(const base::UserMetricsAction& action) override; 104 void RecordAction(const base::UserMetricsAction& action) override;
100 void RecordComputedAction(const std::string& action) override; 105 void RecordComputedAction(const std::string& action) override;
101 MojoShellConnection* GetMojoShellConnection() override; 106 MojoShellConnection* GetMojoShellConnection() override;
102 shell::InterfaceRegistry* GetInterfaceRegistry() override; 107 shell::InterfaceRegistry* GetInterfaceRegistry() override;
103 shell::InterfaceProvider* GetRemoteInterfaces() override; 108 shell::InterfaceProvider* GetRemoteInterfaces() override;
109 mojom::RouteProvider* GetRemoteRouteProvider() override;
104 110
105 IPC::SyncChannel* channel() { return channel_.get(); } 111 IPC::SyncChannel* channel() { return channel_.get(); }
106 112
107 IPC::MessageRouter* GetRouter(); 113 IPC::MessageRouter* GetRouter();
108 114
109 // Allocates a block of shared memory of the given size. Returns NULL on 115 // Allocates a block of shared memory of the given size. Returns NULL on
110 // failure. 116 // failure.
111 // Note: On posix, this requires a sync IPC to the browser process, 117 // Note: On posix, this requires a sync IPC to the browser process,
112 // but on windows the child process directly allocates the block. 118 // but on windows the child process directly allocates the block.
113 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(size_t buf_size); 119 std::unique_ptr<base::SharedMemory> AllocateSharedMemory(size_t buf_size);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 void OnShutdown(); 245 void OnShutdown();
240 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status); 246 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status);
241 void OnGetChildProfilerData(int sequence_number, int current_profiling_phase); 247 void OnGetChildProfilerData(int sequence_number, int current_profiling_phase);
242 void OnProfilingPhaseCompleted(int profiling_phase); 248 void OnProfilingPhaseCompleted(int profiling_phase);
243 #ifdef IPC_MESSAGE_LOG_ENABLED 249 #ifdef IPC_MESSAGE_LOG_ENABLED
244 void OnSetIPCLoggingEnabled(bool enable); 250 void OnSetIPCLoggingEnabled(bool enable);
245 #endif 251 #endif
246 252
247 void EnsureConnected(); 253 void EnsureConnected();
248 254
255 void OnRouteProviderRequest(mojom::RouteProviderAssociatedRequest request);
256
257 // mojom::RouteProvider:
258 void GetRoute(
259 int32_t routing_id,
260 mojom::AssociatedInterfaceProviderAssociatedRequest request) override;
261
262 // mojom::AssociatedInterfaceProvider:
263 void GetAssociatedInterface(
264 const std::string& name,
265 mojom::AssociatedInterfaceAssociatedRequest request) override;
266
249 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; 267 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_;
250 std::unique_ptr<shell::InterfaceRegistry> interface_registry_; 268 std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
251 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_; 269 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
252 std::unique_ptr<MojoShellConnection> mojo_shell_connection_; 270 std::unique_ptr<MojoShellConnection> mojo_shell_connection_;
253 std::unique_ptr<shell::Connection> browser_connection_; 271 std::unique_ptr<shell::Connection> browser_connection_;
254 272
273 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_;
274 mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider>
275 associated_interface_provider_bindings_;
276 mojom::RouteProviderAssociatedPtr remote_route_provider_;
277
255 std::string channel_name_; 278 std::string channel_name_;
256 std::unique_ptr<IPC::SyncChannel> channel_; 279 std::unique_ptr<IPC::SyncChannel> channel_;
257 280
258 // Allows threads other than the main thread to send sync messages. 281 // Allows threads other than the main thread to send sync messages.
259 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; 282 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_;
260 283
261 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 284 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
262 285
263 // Implements message routing functionality to the consumers of 286 // Implements message routing functionality to the consumers of
264 // ChildThreadImpl. 287 // ChildThreadImpl.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 364
342 private: 365 private:
343 struct Options options_; 366 struct Options options_;
344 367
345 DISALLOW_COPY_AND_ASSIGN(Builder); 368 DISALLOW_COPY_AND_ASSIGN(Builder);
346 }; 369 };
347 370
348 } // namespace content 371 } // namespace content
349 372
350 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ 373 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698