| 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 24 matching lines...) Expand all Loading... |
| 35 #include "components/tracing/child/child_trace_message_filter.h" | 35 #include "components/tracing/child/child_trace_message_filter.h" |
| 36 #include "content/child/child_discardable_shared_memory_manager.h" | 36 #include "content/child/child_discardable_shared_memory_manager.h" |
| 37 #include "content/child/child_histogram_message_filter.h" | 37 #include "content/child/child_histogram_message_filter.h" |
| 38 #include "content/child/child_process.h" | 38 #include "content/child/child_process.h" |
| 39 #include "content/child/child_resource_message_filter.h" | 39 #include "content/child/child_resource_message_filter.h" |
| 40 #include "content/child/child_shared_bitmap_manager.h" | 40 #include "content/child/child_shared_bitmap_manager.h" |
| 41 #include "content/child/fileapi/file_system_dispatcher.h" | 41 #include "content/child/fileapi/file_system_dispatcher.h" |
| 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" | |
| 46 #include "content/child/push_messaging/push_dispatcher.h" | 45 #include "content/child/push_messaging/push_dispatcher.h" |
| 47 #include "content/child/quota_dispatcher.h" | 46 #include "content/child/quota_dispatcher.h" |
| 48 #include "content/child/quota_message_filter.h" | 47 #include "content/child/quota_message_filter.h" |
| 49 #include "content/child/resource_dispatcher.h" | 48 #include "content/child/resource_dispatcher.h" |
| 50 #include "content/child/service_worker/service_worker_message_filter.h" | 49 #include "content/child/service_worker/service_worker_message_filter.h" |
| 51 #include "content/child/thread_safe_sender.h" | 50 #include "content/child/thread_safe_sender.h" |
| 52 #include "content/common/child_process_messages.h" | 51 #include "content/common/child_process_messages.h" |
| 53 #include "content/common/in_process_child_thread_params.h" | 52 #include "content/common/in_process_child_thread_params.h" |
| 54 #include "content/public/common/connection_filter.h" | 53 #include "content/public/common/connection_filter.h" |
| 55 #include "content/public/common/content_switches.h" | 54 #include "content/public/common/content_switches.h" |
| 56 #include "content/public/common/mojo_channel_switches.h" | 55 #include "content/public/common/mojo_channel_switches.h" |
| 57 #include "content/public/common/service_manager_connection.h" | 56 #include "content/public/common/service_manager_connection.h" |
| 58 #include "content/public/common/service_names.h" | 57 #include "content/public/common/service_names.h" |
| 58 #include "device/power_monitor/power_monitor_broadcast_source.h" |
| 59 #include "ipc/ipc_channel_mojo.h" | 59 #include "ipc/ipc_channel_mojo.h" |
| 60 #include "ipc/ipc_logging.h" | 60 #include "ipc/ipc_logging.h" |
| 61 #include "ipc/ipc_platform_file.h" | 61 #include "ipc/ipc_platform_file.h" |
| 62 #include "ipc/ipc_sync_channel.h" | 62 #include "ipc/ipc_sync_channel.h" |
| 63 #include "ipc/ipc_sync_message_filter.h" | 63 #include "ipc/ipc_sync_message_filter.h" |
| 64 #include "mojo/edk/embedder/embedder.h" | 64 #include "mojo/edk/embedder/embedder.h" |
| 65 #include "mojo/edk/embedder/named_platform_channel_pair.h" | 65 #include "mojo/edk/embedder/named_platform_channel_pair.h" |
| 66 #include "mojo/edk/embedder/platform_channel_pair.h" | 66 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 67 #include "mojo/edk/embedder/scoped_ipc_support.h" | 67 #include "mojo/edk/embedder/scoped_ipc_support.h" |
| 68 #include "services/service_manager/public/cpp/connector.h" | 68 #include "services/service_manager/public/cpp/connector.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 if (!IsInBrowserProcess()) { | 504 if (!IsInBrowserProcess()) { |
| 505 // In single process mode, browser-side tracing and memory will cover the | 505 // In single process mode, browser-side tracing and memory will cover the |
| 506 // whole process including renderers. | 506 // whole process including renderers. |
| 507 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 507 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 508 ChildProcess::current()->io_task_runner())); | 508 ChildProcess::current()->io_task_runner())); |
| 509 channel_->AddFilter(new ChildMemoryMessageFilter()); | 509 channel_->AddFilter(new ChildMemoryMessageFilter()); |
| 510 } | 510 } |
| 511 | 511 |
| 512 // In single process mode we may already have a power monitor | 512 // In single process mode we may already have a power monitor |
| 513 if (!base::PowerMonitor::Get()) { | 513 if (!base::PowerMonitor::Get()) { |
| 514 std::unique_ptr<PowerMonitorBroadcastSource> power_monitor_source( | 514 std::unique_ptr<device::PowerMonitorBroadcastSource> power_monitor_source( |
| 515 new PowerMonitorBroadcastSource()); | 515 new device::PowerMonitorBroadcastSource()); |
| 516 device::mojom::PowerMonitorPtr power_monitor_message_broadcaster; |
| 517 GetRemoteInterfaces()->GetInterface( |
| 518 mojo::GetProxy(&power_monitor_message_broadcaster)); |
| 519 power_monitor_source->SetClient(power_monitor_message_broadcaster.get()); |
| 520 |
| 516 power_monitor_.reset( | 521 power_monitor_.reset( |
| 517 new base::PowerMonitor(std::move(power_monitor_source))); | 522 new base::PowerMonitor(std::move(power_monitor_source))); |
| 518 } | 523 } |
| 519 | 524 |
| 520 #if defined(OS_POSIX) | 525 #if defined(OS_POSIX) |
| 521 // Check that --process-type is specified so we don't do this in unit tests | 526 // Check that --process-type is specified so we don't do this in unit tests |
| 522 // and single-process mode. | 527 // and single-process mode. |
| 523 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 528 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
| 524 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 529 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
| 525 #endif | 530 #endif |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 Listener* route = router_.GetRoute(routing_id); | 857 Listener* route = router_.GetRoute(routing_id); |
| 853 if (route) | 858 if (route) |
| 854 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); | 859 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); |
| 855 } | 860 } |
| 856 | 861 |
| 857 bool ChildThreadImpl::IsInBrowserProcess() const { | 862 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 858 return static_cast<bool>(browser_process_io_runner_); | 863 return static_cast<bool>(browser_process_io_runner_); |
| 859 } | 864 } |
| 860 | 865 |
| 861 } // namespace content | 866 } // namespace content |
| OLD | NEW |