OLD | NEW |
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/single_thread_task_runner.h" | 18 #include "base/single_thread_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/associated_interfaces.mojom.h" | 21 #include "content/common/associated_interfaces.mojom.h" |
22 #include "content/common/content_export.h" | 22 #include "content/common/content_export.h" |
23 #include "content/public/child/child_thread.h" | 23 #include "content/public/child/child_thread.h" |
24 #include "ipc/ipc.mojom.h" | 24 #include "ipc/ipc.mojom.h" |
25 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. | 25 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. |
26 #include "ipc/ipc_platform_file.h" | 26 #include "ipc/ipc_platform_file.h" |
27 #include "ipc/message_router.h" | 27 #include "ipc/message_router.h" |
28 #include "mojo/public/cpp/bindings/associated_binding.h" | 28 #include "mojo/public/cpp/bindings/associated_binding.h" |
29 #include "mojo/public/cpp/bindings/associated_binding_set.h" | 29 #include "mojo/public/cpp/bindings/associated_binding_set.h" |
30 #include "services/service_manager/public/cpp/service_info.h" | 30 #include "services/service_manager/public/cpp/bind_source_info.h" |
31 | 31 |
32 namespace base { | 32 namespace base { |
33 class MessageLoop; | 33 class MessageLoop; |
34 } // namespace base | 34 } // namespace base |
35 | 35 |
36 namespace IPC { | 36 namespace IPC { |
37 class MessageFilter; | 37 class MessageFilter; |
38 class SyncChannel; | 38 class SyncChannel; |
39 class SyncMessageFilter; | 39 class SyncMessageFilter; |
40 } // namespace IPC | 40 } // namespace IPC |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // ChildThread implementation: | 87 // ChildThread implementation: |
88 #if defined(OS_WIN) | 88 #if defined(OS_WIN) |
89 void PreCacheFont(const LOGFONT& log_font) override; | 89 void PreCacheFont(const LOGFONT& log_font) override; |
90 void ReleaseCachedFonts() override; | 90 void ReleaseCachedFonts() override; |
91 #endif | 91 #endif |
92 void RecordAction(const base::UserMetricsAction& action) override; | 92 void RecordAction(const base::UserMetricsAction& action) override; |
93 void RecordComputedAction(const std::string& action) override; | 93 void RecordComputedAction(const std::string& action) override; |
94 ServiceManagerConnection* GetServiceManagerConnection() override; | 94 ServiceManagerConnection* GetServiceManagerConnection() override; |
95 service_manager::Connector* GetConnector() override; | 95 service_manager::Connector* GetConnector() override; |
96 | 96 |
97 // Returns the service_manager::ServiceInfo for the child process & the | 97 // Returns the service_manager::BindSourceInfo for the child process & the |
98 // browser process, once available. | 98 // browser process, once available. |
99 const service_manager::ServiceInfo& GetChildServiceInfo() const; | 99 const service_manager::BindSourceInfo& GetChildServiceInfo() const; |
100 const service_manager::ServiceInfo& GetBrowserServiceInfo() const; | 100 const service_manager::BindSourceInfo& GetBrowserServiceInfo() const; |
101 bool IsConnectedToBrowser() const; | 101 bool IsConnectedToBrowser() const; |
102 | 102 |
103 IPC::SyncChannel* channel() { return channel_.get(); } | 103 IPC::SyncChannel* channel() { return channel_.get(); } |
104 | 104 |
105 IPC::MessageRouter* GetRouter(); | 105 IPC::MessageRouter* GetRouter(); |
106 | 106 |
107 mojom::RouteProvider* GetRemoteRouteProvider(); | 107 mojom::RouteProvider* GetRemoteRouteProvider(); |
108 | 108 |
109 // Allocates a block of shared memory of the given size. Returns nullptr on | 109 // Allocates a block of shared memory of the given size. Returns nullptr on |
110 // failure. | 110 // failure. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 int32_t routing_id, | 234 int32_t routing_id, |
235 mojom::AssociatedInterfaceProviderAssociatedRequest request) override; | 235 mojom::AssociatedInterfaceProviderAssociatedRequest request) override; |
236 | 236 |
237 // mojom::AssociatedInterfaceProvider: | 237 // mojom::AssociatedInterfaceProvider: |
238 void GetAssociatedInterface( | 238 void GetAssociatedInterface( |
239 const std::string& name, | 239 const std::string& name, |
240 mojom::AssociatedInterfaceAssociatedRequest request) override; | 240 mojom::AssociatedInterfaceAssociatedRequest request) override; |
241 | 241 |
242 // Called when a connection is received from another service. When that other | 242 // Called when a connection is received from another service. When that other |
243 // service is the browser process, stores the remote's info. | 243 // service is the browser process, stores the remote's info. |
244 void OnServiceConnect(const service_manager::ServiceInfo& local_info, | 244 void OnServiceConnect(const service_manager::BindSourceInfo& remote_info); |
245 const service_manager::ServiceInfo& remote_info); | |
246 | 245 |
247 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; | 246 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; |
248 std::unique_ptr<ServiceManagerConnection> service_manager_connection_; | 247 std::unique_ptr<ServiceManagerConnection> service_manager_connection_; |
249 | 248 |
250 bool connected_to_browser_ = false; | 249 bool connected_to_browser_ = false; |
251 service_manager::ServiceInfo child_info_; | 250 service_manager::BindSourceInfo browser_info_; |
252 service_manager::ServiceInfo browser_info_; | |
253 | 251 |
254 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_; | 252 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_; |
255 mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider, int32_t> | 253 mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider, int32_t> |
256 associated_interface_provider_bindings_; | 254 associated_interface_provider_bindings_; |
257 mojom::RouteProviderAssociatedPtr remote_route_provider_; | 255 mojom::RouteProviderAssociatedPtr remote_route_provider_; |
258 | 256 |
259 std::unique_ptr<IPC::SyncChannel> channel_; | 257 std::unique_ptr<IPC::SyncChannel> channel_; |
260 | 258 |
261 // Allows threads other than the main thread to send sync messages. | 259 // Allows threads other than the main thread to send sync messages. |
262 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; | 260 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 329 |
332 private: | 330 private: |
333 struct Options options_; | 331 struct Options options_; |
334 | 332 |
335 DISALLOW_COPY_AND_ASSIGN(Builder); | 333 DISALLOW_COPY_AND_ASSIGN(Builder); |
336 }; | 334 }; |
337 | 335 |
338 } // namespace content | 336 } // namespace content |
339 | 337 |
340 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 338 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
OLD | NEW |