| 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/public/common/content_switches.h" | 54 #include "content/public/common/content_switches.h" |
| 57 #include "content/public/common/mojo_channel_switches.h" | 55 #include "content/public/common/mojo_channel_switches.h" |
| 58 #include "content/public/common/mojo_shell_connection.h" | 56 #include "content/public/common/mojo_shell_connection.h" |
| 59 #include "ipc/attachment_broker.h" | 57 #include "ipc/attachment_broker.h" |
| 60 #include "ipc/attachment_broker_unprivileged.h" | 58 #include "ipc/attachment_broker_unprivileged.h" |
| 61 #include "ipc/ipc_channel_mojo.h" | 59 #include "ipc/ipc_channel_mojo.h" |
| 62 #include "ipc/ipc_logging.h" | 60 #include "ipc/ipc_logging.h" |
| 63 #include "ipc/ipc_platform_file.h" | 61 #include "ipc/ipc_platform_file.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 if (options.auto_start_mojo_shell_connection) | 440 if (options.auto_start_mojo_shell_connection) |
| 443 StartMojoShellConnection(); | 441 StartMojoShellConnection(); |
| 444 } | 442 } |
| 445 | 443 |
| 446 sync_message_filter_ = channel_->CreateSyncMessageFilter(); | 444 sync_message_filter_ = channel_->CreateSyncMessageFilter(); |
| 447 thread_safe_sender_ = new ThreadSafeSender( | 445 thread_safe_sender_ = new ThreadSafeSender( |
| 448 message_loop_->task_runner(), sync_message_filter_.get()); | 446 message_loop_->task_runner(), sync_message_filter_.get()); |
| 449 | 447 |
| 450 resource_dispatcher_.reset(new ResourceDispatcher( | 448 resource_dispatcher_.reset(new ResourceDispatcher( |
| 451 this, message_loop()->task_runner())); | 449 this, message_loop()->task_runner())); |
| 452 websocket_dispatcher_.reset(new WebSocketDispatcher); | |
| 453 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 450 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
| 454 | 451 |
| 455 histogram_message_filter_ = new ChildHistogramMessageFilter(); | 452 histogram_message_filter_ = new ChildHistogramMessageFilter(); |
| 456 resource_message_filter_ = | 453 resource_message_filter_ = |
| 457 new ChildResourceMessageFilter(resource_dispatcher()); | 454 new ChildResourceMessageFilter(resource_dispatcher()); |
| 458 | 455 |
| 459 service_worker_message_filter_ = | 456 service_worker_message_filter_ = |
| 460 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); | 457 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); |
| 461 | 458 |
| 462 quota_message_filter_ = | 459 quota_message_filter_ = |
| 463 new QuotaMessageFilter(thread_safe_sender_.get()); | 460 new QuotaMessageFilter(thread_safe_sender_.get()); |
| 464 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), | 461 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), |
| 465 quota_message_filter_.get())); | 462 quota_message_filter_.get())); |
| 466 notification_dispatcher_ = | 463 notification_dispatcher_ = |
| 467 new NotificationDispatcher(thread_safe_sender_.get()); | 464 new NotificationDispatcher(thread_safe_sender_.get()); |
| 468 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); | 465 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); |
| 469 | 466 |
| 470 websocket_message_filter_ = | |
| 471 new WebSocketMessageFilter(websocket_dispatcher_.get()); | |
| 472 | |
| 473 channel_->AddFilter(histogram_message_filter_.get()); | 467 channel_->AddFilter(histogram_message_filter_.get()); |
| 474 channel_->AddFilter(resource_message_filter_.get()); | 468 channel_->AddFilter(resource_message_filter_.get()); |
| 475 channel_->AddFilter(quota_message_filter_->GetFilter()); | 469 channel_->AddFilter(quota_message_filter_->GetFilter()); |
| 476 channel_->AddFilter(notification_dispatcher_->GetFilter()); | 470 channel_->AddFilter(notification_dispatcher_->GetFilter()); |
| 477 channel_->AddFilter(push_dispatcher_->GetFilter()); | 471 channel_->AddFilter(push_dispatcher_->GetFilter()); |
| 478 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 472 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
| 479 channel_->AddFilter(websocket_message_filter_.get()); | |
| 480 | 473 |
| 481 if (!IsInBrowserProcess()) { | 474 if (!IsInBrowserProcess()) { |
| 482 // In single process mode, browser-side tracing and memory will cover the | 475 // In single process mode, browser-side tracing and memory will cover the |
| 483 // whole process including renderers. | 476 // whole process including renderers. |
| 484 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 477 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 485 ChildProcess::current()->io_task_runner())); | 478 ChildProcess::current()->io_task_runner())); |
| 486 channel_->AddFilter(new ChildMemoryMessageFilter()); | 479 channel_->AddFilter(new ChildMemoryMessageFilter()); |
| 487 } | 480 } |
| 488 | 481 |
| 489 // In single process mode we may already have a power monitor | 482 // In single process mode we may already have a power monitor |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 void ChildThreadImpl::EnsureConnected() { | 779 void ChildThreadImpl::EnsureConnected() { |
| 787 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 780 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
| 788 base::Process::Current().Terminate(0, false); | 781 base::Process::Current().Terminate(0, false); |
| 789 } | 782 } |
| 790 | 783 |
| 791 bool ChildThreadImpl::IsInBrowserProcess() const { | 784 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 792 return static_cast<bool>(browser_process_io_runner_); | 785 return static_cast<bool>(browser_process_io_runner_); |
| 793 } | 786 } |
| 794 | 787 |
| 795 } // namespace content | 788 } // namespace content |
| OLD | NEW |