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 #include "content/child/child_thread_impl.h" | 5 #include "content/child/child_thread_impl.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "content/child/fileapi/webfilesystem_impl.h" | 42 #include "content/child/fileapi/webfilesystem_impl.h" |
43 #include "content/child/memory/child_memory_message_filter.h" | 43 #include "content/child/memory/child_memory_message_filter.h" |
44 #include "content/child/notifications/notification_dispatcher.h" | 44 #include "content/child/notifications/notification_dispatcher.h" |
45 #include "content/child/power_monitor_broadcast_source.h" | 45 #include "content/child/power_monitor_broadcast_source.h" |
46 #include "content/child/push_messaging/push_dispatcher.h" | 46 #include "content/child/push_messaging/push_dispatcher.h" |
47 #include "content/child/quota_dispatcher.h" | 47 #include "content/child/quota_dispatcher.h" |
48 #include "content/child/quota_message_filter.h" | 48 #include "content/child/quota_message_filter.h" |
49 #include "content/child/resource_dispatcher.h" | 49 #include "content/child/resource_dispatcher.h" |
50 #include "content/child/service_worker/service_worker_message_filter.h" | 50 #include "content/child/service_worker/service_worker_message_filter.h" |
51 #include "content/child/thread_safe_sender.h" | 51 #include "content/child/thread_safe_sender.h" |
52 #include "content/child/websocket_dispatcher.h" | |
53 #include "content/child/websocket_message_filter.h" | |
54 #include "content/common/child_process_messages.h" | 52 #include "content/common/child_process_messages.h" |
55 #include "content/common/in_process_child_thread_params.h" | 53 #include "content/common/in_process_child_thread_params.h" |
56 #include "content/common/mojo/constants.h" | 54 #include "content/common/mojo/constants.h" |
57 #include "content/public/common/content_switches.h" | 55 #include "content/public/common/content_switches.h" |
58 #include "content/public/common/mojo_channel_switches.h" | 56 #include "content/public/common/mojo_channel_switches.h" |
59 #include "content/public/common/mojo_shell_connection.h" | 57 #include "content/public/common/mojo_shell_connection.h" |
60 #include "ipc/attachment_broker.h" | 58 #include "ipc/attachment_broker.h" |
61 #include "ipc/attachment_broker_unprivileged.h" | 59 #include "ipc/attachment_broker_unprivileged.h" |
62 #include "ipc/ipc_channel_mojo.h" | 60 #include "ipc/ipc_channel_mojo.h" |
63 #include "ipc/ipc_logging.h" | 61 #include "ipc/ipc_logging.h" |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 if (options.auto_start_mojo_shell_connection) | 461 if (options.auto_start_mojo_shell_connection) |
464 StartMojoShellConnection(); | 462 StartMojoShellConnection(); |
465 } | 463 } |
466 | 464 |
467 sync_message_filter_ = channel_->CreateSyncMessageFilter(); | 465 sync_message_filter_ = channel_->CreateSyncMessageFilter(); |
468 thread_safe_sender_ = new ThreadSafeSender( | 466 thread_safe_sender_ = new ThreadSafeSender( |
469 message_loop_->task_runner(), sync_message_filter_.get()); | 467 message_loop_->task_runner(), sync_message_filter_.get()); |
470 | 468 |
471 resource_dispatcher_.reset(new ResourceDispatcher( | 469 resource_dispatcher_.reset(new ResourceDispatcher( |
472 this, message_loop()->task_runner())); | 470 this, message_loop()->task_runner())); |
473 websocket_dispatcher_.reset(new WebSocketDispatcher); | |
474 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 471 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
475 | 472 |
476 histogram_message_filter_ = new ChildHistogramMessageFilter(); | 473 histogram_message_filter_ = new ChildHistogramMessageFilter(); |
477 resource_message_filter_ = | 474 resource_message_filter_ = |
478 new ChildResourceMessageFilter(resource_dispatcher()); | 475 new ChildResourceMessageFilter(resource_dispatcher()); |
479 | 476 |
480 service_worker_message_filter_ = | 477 service_worker_message_filter_ = |
481 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); | 478 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); |
482 | 479 |
483 quota_message_filter_ = | 480 quota_message_filter_ = |
484 new QuotaMessageFilter(thread_safe_sender_.get()); | 481 new QuotaMessageFilter(thread_safe_sender_.get()); |
485 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), | 482 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), |
486 quota_message_filter_.get())); | 483 quota_message_filter_.get())); |
487 notification_dispatcher_ = | 484 notification_dispatcher_ = |
488 new NotificationDispatcher(thread_safe_sender_.get()); | 485 new NotificationDispatcher(thread_safe_sender_.get()); |
489 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); | 486 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); |
490 | 487 |
491 websocket_message_filter_ = | |
492 new WebSocketMessageFilter(websocket_dispatcher_.get()); | |
493 | |
494 channel_->AddFilter(histogram_message_filter_.get()); | 488 channel_->AddFilter(histogram_message_filter_.get()); |
495 channel_->AddFilter(resource_message_filter_.get()); | 489 channel_->AddFilter(resource_message_filter_.get()); |
496 channel_->AddFilter(quota_message_filter_->GetFilter()); | 490 channel_->AddFilter(quota_message_filter_->GetFilter()); |
497 channel_->AddFilter(notification_dispatcher_->GetFilter()); | 491 channel_->AddFilter(notification_dispatcher_->GetFilter()); |
498 channel_->AddFilter(push_dispatcher_->GetFilter()); | 492 channel_->AddFilter(push_dispatcher_->GetFilter()); |
499 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 493 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
500 channel_->AddFilter(websocket_message_filter_.get()); | |
501 | 494 |
502 if (!IsInBrowserProcess()) { | 495 if (!IsInBrowserProcess()) { |
503 // In single process mode, browser-side tracing and memory will cover the | 496 // In single process mode, browser-side tracing and memory will cover the |
504 // whole process including renderers. | 497 // whole process including renderers. |
505 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 498 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
506 ChildProcess::current()->io_task_runner())); | 499 ChildProcess::current()->io_task_runner())); |
507 channel_->AddFilter(new ChildMemoryMessageFilter()); | 500 channel_->AddFilter(new ChildMemoryMessageFilter()); |
508 } | 501 } |
509 | 502 |
510 // In single process mode we may already have a power monitor | 503 // In single process mode we may already have a power monitor |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 void ChildThreadImpl::EnsureConnected() { | 803 void ChildThreadImpl::EnsureConnected() { |
811 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 804 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
812 base::Process::Current().Terminate(0, false); | 805 base::Process::Current().Terminate(0, false); |
813 } | 806 } |
814 | 807 |
815 bool ChildThreadImpl::IsInBrowserProcess() const { | 808 bool ChildThreadImpl::IsInBrowserProcess() const { |
816 return static_cast<bool>(browser_process_io_runner_); | 809 return static_cast<bool>(browser_process_io_runner_); |
817 } | 810 } |
818 | 811 |
819 } // namespace content | 812 } // namespace content |
OLD | NEW |