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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "content/child/memory/child_memory_message_filter.h" | 43 #include "content/child/memory/child_memory_message_filter.h" |
44 #include "content/child/mojo/mojo_application.h" | 44 #include "content/child/mojo/mojo_application.h" |
45 #include "content/child/notifications/notification_dispatcher.h" | 45 #include "content/child/notifications/notification_dispatcher.h" |
46 #include "content/child/power_monitor_broadcast_source.h" | 46 #include "content/child/power_monitor_broadcast_source.h" |
47 #include "content/child/push_messaging/push_dispatcher.h" | 47 #include "content/child/push_messaging/push_dispatcher.h" |
48 #include "content/child/quota_dispatcher.h" | 48 #include "content/child/quota_dispatcher.h" |
49 #include "content/child/quota_message_filter.h" | 49 #include "content/child/quota_message_filter.h" |
50 #include "content/child/resource_dispatcher.h" | 50 #include "content/child/resource_dispatcher.h" |
51 #include "content/child/service_worker/service_worker_message_filter.h" | 51 #include "content/child/service_worker/service_worker_message_filter.h" |
52 #include "content/child/thread_safe_sender.h" | 52 #include "content/child/thread_safe_sender.h" |
53 #include "content/child/websocket_dispatcher.h" | |
54 #include "content/child/websocket_message_filter.h" | |
55 #include "content/common/child_process_messages.h" | 53 #include "content/common/child_process_messages.h" |
56 #include "content/common/in_process_child_thread_params.h" | 54 #include "content/common/in_process_child_thread_params.h" |
57 #include "content/common/mojo/mojo_shell_connection_impl.h" | 55 #include "content/common/mojo/mojo_shell_connection_impl.h" |
58 #include "content/public/common/content_switches.h" | 56 #include "content/public/common/content_switches.h" |
59 #include "content/public/common/mojo_channel_switches.h" | 57 #include "content/public/common/mojo_channel_switches.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_logging.h" | 60 #include "ipc/ipc_logging.h" |
63 #include "ipc/ipc_platform_file.h" | 61 #include "ipc/ipc_platform_file.h" |
64 #include "ipc/ipc_switches.h" | 62 #include "ipc/ipc_switches.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 415 } |
418 if (!mojo_application_token.empty()) | 416 if (!mojo_application_token.empty()) |
419 mojo_application_->InitWithToken(mojo_application_token); | 417 mojo_application_->InitWithToken(mojo_application_token); |
420 | 418 |
421 sync_message_filter_ = channel_->CreateSyncMessageFilter(); | 419 sync_message_filter_ = channel_->CreateSyncMessageFilter(); |
422 thread_safe_sender_ = new ThreadSafeSender( | 420 thread_safe_sender_ = new ThreadSafeSender( |
423 message_loop_->task_runner(), sync_message_filter_.get()); | 421 message_loop_->task_runner(), sync_message_filter_.get()); |
424 | 422 |
425 resource_dispatcher_.reset(new ResourceDispatcher( | 423 resource_dispatcher_.reset(new ResourceDispatcher( |
426 this, message_loop()->task_runner())); | 424 this, message_loop()->task_runner())); |
427 websocket_dispatcher_.reset(new WebSocketDispatcher); | |
428 file_system_dispatcher_.reset(new FileSystemDispatcher()); | 425 file_system_dispatcher_.reset(new FileSystemDispatcher()); |
429 | 426 |
430 histogram_message_filter_ = new ChildHistogramMessageFilter(); | 427 histogram_message_filter_ = new ChildHistogramMessageFilter(); |
431 resource_message_filter_ = | 428 resource_message_filter_ = |
432 new ChildResourceMessageFilter(resource_dispatcher()); | 429 new ChildResourceMessageFilter(resource_dispatcher()); |
433 | 430 |
434 service_worker_message_filter_ = | 431 service_worker_message_filter_ = |
435 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); | 432 new ServiceWorkerMessageFilter(thread_safe_sender_.get()); |
436 | 433 |
437 quota_message_filter_ = | 434 quota_message_filter_ = |
438 new QuotaMessageFilter(thread_safe_sender_.get()); | 435 new QuotaMessageFilter(thread_safe_sender_.get()); |
439 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), | 436 quota_dispatcher_.reset(new QuotaDispatcher(thread_safe_sender_.get(), |
440 quota_message_filter_.get())); | 437 quota_message_filter_.get())); |
441 notification_dispatcher_ = | 438 notification_dispatcher_ = |
442 new NotificationDispatcher(thread_safe_sender_.get()); | 439 new NotificationDispatcher(thread_safe_sender_.get()); |
443 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); | 440 push_dispatcher_ = new PushDispatcher(thread_safe_sender_.get()); |
444 | 441 |
445 websocket_message_filter_ = | |
446 new WebSocketMessageFilter(websocket_dispatcher_.get()); | |
447 | |
448 channel_->AddFilter(histogram_message_filter_.get()); | 442 channel_->AddFilter(histogram_message_filter_.get()); |
449 channel_->AddFilter(resource_message_filter_.get()); | 443 channel_->AddFilter(resource_message_filter_.get()); |
450 channel_->AddFilter(quota_message_filter_->GetFilter()); | 444 channel_->AddFilter(quota_message_filter_->GetFilter()); |
451 channel_->AddFilter(notification_dispatcher_->GetFilter()); | 445 channel_->AddFilter(notification_dispatcher_->GetFilter()); |
452 channel_->AddFilter(push_dispatcher_->GetFilter()); | 446 channel_->AddFilter(push_dispatcher_->GetFilter()); |
453 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 447 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
454 channel_->AddFilter(websocket_message_filter_.get()); | |
455 | 448 |
456 if (!IsInBrowserProcess()) { | 449 if (!IsInBrowserProcess()) { |
457 // In single process mode, browser-side tracing and memory will cover the | 450 // In single process mode, browser-side tracing and memory will cover the |
458 // whole process including renderers. | 451 // whole process including renderers. |
459 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 452 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
460 ChildProcess::current()->io_task_runner())); | 453 ChildProcess::current()->io_task_runner())); |
461 channel_->AddFilter(new ChildMemoryMessageFilter()); | 454 channel_->AddFilter(new ChildMemoryMessageFilter()); |
462 } | 455 } |
463 | 456 |
464 // In single process mode we may already have a power monitor | 457 // In single process mode we may already have a power monitor |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 void ChildThreadImpl::EnsureConnected() { | 736 void ChildThreadImpl::EnsureConnected() { |
744 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 737 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
745 base::Process::Current().Terminate(0, false); | 738 base::Process::Current().Terminate(0, false); |
746 } | 739 } |
747 | 740 |
748 bool ChildThreadImpl::IsInBrowserProcess() const { | 741 bool ChildThreadImpl::IsInBrowserProcess() const { |
749 return static_cast<bool>(browser_process_io_runner_); | 742 return static_cast<bool>(browser_process_io_runner_); |
750 } | 743 } |
751 | 744 |
752 } // namespace content | 745 } // namespace content |
OLD | NEW |