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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 bool RouteMessage(const IPC::Message& msg) override; | 233 bool RouteMessage(const IPC::Message& msg) override; |
234 | 234 |
235 private: | 235 private: |
236 IPC::Sender* const sender_; | 236 IPC::Sender* const sender_; |
237 }; | 237 }; |
238 | 238 |
239 void Init(const Options& options); | 239 void Init(const Options& options); |
240 | 240 |
241 // We create the channel first without connecting it so we can add filters | 241 // We create the channel first without connecting it so we can add filters |
242 // prior to any messages being received, then connect it afterwards. | 242 // prior to any messages being received, then connect it afterwards. |
243 void ConnectChannel(bool use_mojo_channel); | 243 void ConnectChannel(); |
244 | 244 |
245 // IPC message handlers. | 245 // IPC message handlers. |
246 void OnShutdown(); | 246 void OnShutdown(); |
247 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status); | 247 void OnSetProfilerStatus(tracked_objects::ThreadData::Status status); |
248 void OnGetChildProfilerData(int sequence_number, int current_profiling_phase); | 248 void OnGetChildProfilerData(int sequence_number, int current_profiling_phase); |
249 void OnProfilingPhaseCompleted(int profiling_phase); | 249 void OnProfilingPhaseCompleted(int profiling_phase); |
250 #ifdef IPC_MESSAGE_LOG_ENABLED | 250 #ifdef IPC_MESSAGE_LOG_ENABLED |
251 void OnSetIPCLoggingEnabled(bool enable); | 251 void OnSetIPCLoggingEnabled(bool enable); |
252 #endif | 252 #endif |
253 | 253 |
(...skipping 15 matching lines...) Expand all Loading... |
269 std::unique_ptr<shell::InterfaceRegistry> interface_registry_; | 269 std::unique_ptr<shell::InterfaceRegistry> interface_registry_; |
270 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_; | 270 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_; |
271 std::unique_ptr<MojoShellConnection> mojo_shell_connection_; | 271 std::unique_ptr<MojoShellConnection> mojo_shell_connection_; |
272 std::unique_ptr<shell::Connection> browser_connection_; | 272 std::unique_ptr<shell::Connection> browser_connection_; |
273 | 273 |
274 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_; | 274 mojo::AssociatedBinding<mojom::RouteProvider> route_provider_binding_; |
275 mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider> | 275 mojo::AssociatedBindingSet<mojom::AssociatedInterfaceProvider> |
276 associated_interface_provider_bindings_; | 276 associated_interface_provider_bindings_; |
277 mojom::RouteProviderAssociatedPtr remote_route_provider_; | 277 mojom::RouteProviderAssociatedPtr remote_route_provider_; |
278 | 278 |
279 std::string channel_name_; | |
280 std::unique_ptr<IPC::SyncChannel> channel_; | 279 std::unique_ptr<IPC::SyncChannel> channel_; |
281 | 280 |
282 // Allows threads other than the main thread to send sync messages. | 281 // Allows threads other than the main thread to send sync messages. |
283 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; | 282 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter_; |
284 | 283 |
285 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 284 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
286 | 285 |
287 // Implements message routing functionality to the consumers of | 286 // Implements message routing functionality to the consumers of |
288 // ChildThreadImpl. | 287 // ChildThreadImpl. |
289 ChildThreadMessageRouter router_; | 288 ChildThreadMessageRouter router_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 328 |
330 DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl); | 329 DISALLOW_COPY_AND_ASSIGN(ChildThreadImpl); |
331 }; | 330 }; |
332 | 331 |
333 struct ChildThreadImpl::Options { | 332 struct ChildThreadImpl::Options { |
334 Options(const Options& other); | 333 Options(const Options& other); |
335 ~Options(); | 334 ~Options(); |
336 | 335 |
337 class Builder; | 336 class Builder; |
338 | 337 |
339 std::string channel_name; | |
340 bool use_mojo_channel; | |
341 bool auto_start_mojo_shell_connection; | 338 bool auto_start_mojo_shell_connection; |
342 bool connect_to_browser; | 339 bool connect_to_browser; |
343 scoped_refptr<base::SequencedTaskRunner> browser_process_io_runner; | 340 scoped_refptr<base::SequencedTaskRunner> browser_process_io_runner; |
344 std::vector<IPC::MessageFilter*> startup_filters; | 341 std::vector<IPC::MessageFilter*> startup_filters; |
345 std::string in_process_application_token; | 342 std::string in_process_application_token; |
346 | 343 |
347 private: | 344 private: |
348 Options(); | 345 Options(); |
349 }; | 346 }; |
350 | 347 |
351 class ChildThreadImpl::Options::Builder { | 348 class ChildThreadImpl::Options::Builder { |
352 public: | 349 public: |
353 Builder(); | 350 Builder(); |
354 | 351 |
355 Builder& InBrowserProcess(const InProcessChildThreadParams& params); | 352 Builder& InBrowserProcess(const InProcessChildThreadParams& params); |
356 Builder& UseMojoChannel(bool use_mojo_channel); | |
357 Builder& AutoStartMojoShellConnection(bool auto_start); | 353 Builder& AutoStartMojoShellConnection(bool auto_start); |
358 Builder& ConnectToBrowser(bool connect_to_browser); | 354 Builder& ConnectToBrowser(bool connect_to_browser); |
359 Builder& WithChannelName(const std::string& channel_name); | |
360 Builder& AddStartupFilter(IPC::MessageFilter* filter); | 355 Builder& AddStartupFilter(IPC::MessageFilter* filter); |
361 | 356 |
362 Options Build(); | 357 Options Build(); |
363 | 358 |
364 private: | 359 private: |
365 struct Options options_; | 360 struct Options options_; |
366 | 361 |
367 DISALLOW_COPY_AND_ASSIGN(Builder); | 362 DISALLOW_COPY_AND_ASSIGN(Builder); |
368 }; | 363 }; |
369 | 364 |
370 } // namespace content | 365 } // namespace content |
371 | 366 |
372 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ | 367 #endif // CONTENT_CHILD_CHILD_THREAD_IMPL_H_ |
OLD | NEW |