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