Chromium Code Reviews| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 "mojo/public/cpp/system/buffer.h" | 68 #include "mojo/public/cpp/system/buffer.h" |
| 69 #include "mojo/public/cpp/system/platform_handle.h" | 69 #include "mojo/public/cpp/system/platform_handle.h" |
| 70 #include "services/device/public/cpp/constants.h" | |
| 70 #include "services/service_manager/public/cpp/connector.h" | 71 #include "services/service_manager/public/cpp/connector.h" |
| 71 #include "services/service_manager/public/cpp/interface_factory.h" | 72 #include "services/service_manager/public/cpp/interface_factory.h" |
| 72 #include "services/service_manager/public/cpp/interface_provider.h" | 73 #include "services/service_manager/public/cpp/interface_provider.h" |
| 73 #include "services/service_manager/public/cpp/interface_registry.h" | 74 #include "services/service_manager/public/cpp/interface_registry.h" |
| 74 #include "services/service_manager/runner/common/client_util.h" | 75 #include "services/service_manager/runner/common/client_util.h" |
| 75 | 76 |
| 76 #if defined(OS_POSIX) | 77 #if defined(OS_POSIX) |
| 77 #include "base/posix/global_descriptors.h" | 78 #include "base/posix/global_descriptors.h" |
| 78 #include "content/public/common/content_descriptors.h" | 79 #include "content/public/common/content_descriptors.h" |
| 79 #endif | 80 #endif |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 532 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
| 532 | 533 |
| 533 if (!IsInBrowserProcess()) { | 534 if (!IsInBrowserProcess()) { |
| 534 // In single process mode, browser-side tracing and memory will cover the | 535 // In single process mode, browser-side tracing and memory will cover the |
| 535 // whole process including renderers. | 536 // whole process including renderers. |
| 536 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 537 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 537 ChildProcess::current()->io_task_runner())); | 538 ChildProcess::current()->io_task_runner())); |
| 538 channel_->AddFilter(new ChildMemoryMessageFilter()); | 539 channel_->AddFilter(new ChildMemoryMessageFilter()); |
| 539 } | 540 } |
| 540 | 541 |
| 541 // In single process mode we may already have a power monitor | 542 // In single process mode we may already have a power monitor. |
| 542 if (!base::PowerMonitor::Get()) { | 543 if (!base::PowerMonitor::Get()) { |
| 544 std::unique_ptr<service_manager::Connection> device_connection; | |
| 545 service_manager::InterfaceProvider* remote_interfaces = nullptr; | |
| 546 if (service_manager_connection_) { | |
|
leonhsl(Using Gerrit)
2016/11/17 10:28:03
Should we use DCHECK(service_manager_connection_)
blundell
2016/11/22 16:46:44
I'm not sure either. Ken?
Ken Rockot(use gerrit already)
2016/11/22 17:23:40
There are still a few edge cases where there is no
| |
| 547 device_connection = service_manager_connection_->GetConnector()->Connect( | |
| 548 device::kDeviceServiceName); | |
| 549 remote_interfaces = device_connection->GetRemoteInterfaces(); | |
| 550 } | |
| 543 std::unique_ptr<device::PowerMonitorBroadcastSource> power_monitor_source( | 551 std::unique_ptr<device::PowerMonitorBroadcastSource> power_monitor_source( |
| 544 new device::PowerMonitorBroadcastSource(GetRemoteInterfaces())); | 552 new device::PowerMonitorBroadcastSource(remote_interfaces)); |
| 545 | 553 |
| 546 power_monitor_.reset( | 554 power_monitor_.reset( |
| 547 new base::PowerMonitor(std::move(power_monitor_source))); | 555 new base::PowerMonitor(std::move(power_monitor_source))); |
| 548 } | 556 } |
| 549 | 557 |
| 550 #if defined(OS_POSIX) | 558 #if defined(OS_POSIX) |
| 551 // Check that --process-type is specified so we don't do this in unit tests | 559 // Check that --process-type is specified so we don't do this in unit tests |
| 552 // and single-process mode. | 560 // and single-process mode. |
| 553 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 561 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
| 554 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 562 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 connected_to_browser_ = true; | 924 connected_to_browser_ = true; |
| 917 child_info_ = local_info; | 925 child_info_ = local_info; |
| 918 browser_info_ = remote_info; | 926 browser_info_ = remote_info; |
| 919 } | 927 } |
| 920 | 928 |
| 921 bool ChildThreadImpl::IsInBrowserProcess() const { | 929 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 922 return static_cast<bool>(browser_process_io_runner_); | 930 return static_cast<bool>(browser_process_io_runner_); |
| 923 } | 931 } |
| 924 | 932 |
| 925 } // namespace content | 933 } // namespace content |
| OLD | NEW |