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 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // IPC::Sender implementation: | 95 // IPC::Sender implementation: |
96 bool Send(IPC::Message* msg) override; | 96 bool Send(IPC::Message* msg) override; |
97 | 97 |
98 // ChildThread implementation: | 98 // ChildThread implementation: |
99 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
100 void PreCacheFont(const LOGFONT& log_font) override; | 100 void PreCacheFont(const LOGFONT& log_font) override; |
101 void ReleaseCachedFonts() override; | 101 void ReleaseCachedFonts() override; |
102 #endif | 102 #endif |
103 void RecordAction(const base::UserMetricsAction& action) override; | 103 void RecordAction(const base::UserMetricsAction& action) override; |
104 void RecordComputedAction(const std::string& action) override; | 104 void RecordComputedAction(const std::string& action) override; |
105 MojoShellConnection* GetMojoShellConnection() override; | 105 ServiceManagerConnection* GetServiceManagerConnection() override; |
106 shell::InterfaceRegistry* GetInterfaceRegistry() override; | 106 shell::InterfaceRegistry* GetInterfaceRegistry() override; |
107 shell::InterfaceProvider* GetRemoteInterfaces() override; | 107 shell::InterfaceProvider* GetRemoteInterfaces() override; |
108 | 108 |
109 IPC::SyncChannel* channel() { return channel_.get(); } | 109 IPC::SyncChannel* channel() { return channel_.get(); } |
110 | 110 |
111 IPC::MessageRouter* GetRouter(); | 111 IPC::MessageRouter* GetRouter(); |
112 | 112 |
113 mojom::RouteProvider* GetRemoteRouteProvider(); | 113 mojom::RouteProvider* GetRemoteRouteProvider(); |
114 | 114 |
115 // 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 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // process. | 198 // process. |
199 static void ShutdownThread(); | 199 static void ShutdownThread(); |
200 #endif | 200 #endif |
201 | 201 |
202 protected: | 202 protected: |
203 friend class ChildProcess; | 203 friend class ChildProcess; |
204 | 204 |
205 // Called when the process refcount is 0. | 205 // Called when the process refcount is 0. |
206 void OnProcessFinalRelease(); | 206 void OnProcessFinalRelease(); |
207 | 207 |
208 // Called by subclasses to manually start the MojoShellConnection. Must only | 208 // Called by subclasses to manually start the ServiceManagerConnection. Must |
209 // be called if ChildThreadImpl::Options::auto_start_mojo_shell_connection | 209 // only be called if |
210 // was set to |false| on ChildThreadImpl construction. | 210 // ChildThreadImpl::Options::auto_start_service_manager_connection was set to |
211 void StartMojoShellConnection(); | 211 // |false| on ChildThreadImpl construction. |
| 212 void StartServiceManagerConnection(); |
212 | 213 |
213 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 214 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
214 virtual void OnProcessBackgrounded(bool backgrounded); | 215 virtual void OnProcessBackgrounded(bool backgrounded); |
215 virtual void OnProcessPurgeAndSuspend(); | 216 virtual void OnProcessPurgeAndSuspend(); |
216 | 217 |
217 // IPC::Listener implementation: | 218 // IPC::Listener implementation: |
218 bool OnMessageReceived(const IPC::Message& msg) override; | 219 bool OnMessageReceived(const IPC::Message& msg) override; |
219 void OnChannelConnected(int32_t peer_pid) override; | 220 void OnChannelConnected(int32_t peer_pid) override; |
220 void OnChannelError() override; | 221 void OnChannelError() override; |
221 | 222 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 mojom::AssociatedInterfaceProviderAssociatedRequest request) override; | 262 mojom::AssociatedInterfaceProviderAssociatedRequest request) override; |
262 | 263 |
263 // mojom::AssociatedInterfaceProvider: | 264 // mojom::AssociatedInterfaceProvider: |
264 void GetAssociatedInterface( | 265 void GetAssociatedInterface( |
265 const std::string& name, | 266 const std::string& name, |
266 mojom::AssociatedInterfaceAssociatedRequest request) override; | 267 mojom::AssociatedInterfaceAssociatedRequest request) override; |
267 | 268 |
268 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; | 269 std::unique_ptr<mojo::edk::ScopedIPCSupport> mojo_ipc_support_; |
269 std::unique_ptr<shell::InterfaceRegistry> interface_registry_; | 270 std::unique_ptr<shell::InterfaceRegistry> interface_registry_; |
270 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_; | 271 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_; |
271 std::unique_ptr<MojoShellConnection> mojo_shell_connection_; | 272 std::unique_ptr<ServiceManagerConnection> service_manager_connection_; |
272 std::unique_ptr<shell::Connection> browser_connection_; | 273 std::unique_ptr<shell::Connection> browser_connection_; |
273 | 274 |
274 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_; | 275 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_; |
275 mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider> | 276 mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider> |
276 associated_interface_provider_bindings_; | 277 associated_interface_provider_bindings_; |
277 mojom::RouteProviderAssociatedPtr remote_route_provider_; | 278 mojom::RouteProviderAssociatedPtr remote_route_provider_; |
278 | 279 |
279 std::unique_ptr<IPC::SyncChannel> channel_; | 280 std::unique_ptr<IPC::SyncChannel> channel_; |
280 | 281 |
281 // Allows threads other than the main thread to send sync messages. | 282 // Allows threads other than the main thread to send sync messages. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 329 |
329 DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl); | 330 DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl); |
330 }; | 331 }; |
331 | 332 |
332 struct ChildThreadImpl::Options { | 333 struct ChildThreadImpl::Options { |
333 Options(const Options& other); | 334 Options(const Options& other); |
334 ~Options(); | 335 ~Options(); |
335 | 336 |
336 class Builder; | 337 class Builder; |
337 | 338 |
338 bool auto_start_mojo_shell_connection; | 339 bool auto_start_service_manager_connection; |
339 bool connect_to_browser; | 340 bool connect_to_browser; |
340 scoped_refptr<base::SequencedTaskRunner> browser_process_io_runner; | 341 scoped_refptr<base::SequencedTaskRunner> browser_process_io_runner; |
341 std::vector<IPC::MessageFilter*> startup_filters; | 342 std::vector<IPC::MessageFilter*> startup_filters; |
342 std::string in_process_application_token; | 343 std::string in_process_service_request_token; |
343 | 344 |
344 private: | 345 private: |
345 Options(); | 346 Options(); |
346 }; | 347 }; |
347 | 348 |
348 class ChildThreadImpl::Options::Builder { | 349 class ChildThreadImpl::Options::Builder { |
349 public: | 350 public: |
350 Builder(); | 351 Builder(); |
351 | 352 |
352 Builder& InBrowserProcess(const InProcessChildThreadParams& params); | 353 Builder& InBrowserProcess(const InProcessChildThreadParams& params); |
353 Builder& AutoStartMojoShellConnection(bool auto_start); | 354 Builder& AutoStartServiceManagerConnection(bool auto_start); |
354 Builder& ConnectToBrowser(bool connect_to_browser); | 355 Builder& ConnectToBrowser(bool connect_to_browser); |
355 Builder& AddStartupFilter(IPC::MessageFilter* filter); | 356 Builder& AddStartupFilter(IPC::MessageFilter* filter); |
356 | 357 |
357 Options Build(); | 358 Options Build(); |
358 | 359 |
359 private: | 360 private: |
360 struct Options options_; | 361 struct Options options_; |
361 | 362 |
362 DISALLOW_COPY_AND_ASSIGN(Builder); | 363 DISALLOW_COPY_AND_ASSIGN(Builder); |
363 }; | 364 }; |
364 | 365 |
365 } // namespace content | 366 } // namespace content |
366 | 367 |
367 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 368 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
OLD | NEW |