| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "ipc/ipc_platform_file.h" | 59 #include "ipc/ipc_platform_file.h" |
| 60 #include "ipc/ipc_sync_channel.h" | 60 #include "ipc/ipc_sync_channel.h" |
| 61 #include "ipc/ipc_sync_message_filter.h" | 61 #include "ipc/ipc_sync_message_filter.h" |
| 62 #include "mojo/edk/embedder/embedder.h" | 62 #include "mojo/edk/embedder/embedder.h" |
| 63 #include "mojo/edk/embedder/named_platform_channel_pair.h" | 63 #include "mojo/edk/embedder/named_platform_channel_pair.h" |
| 64 #include "mojo/edk/embedder/platform_channel_pair.h" | 64 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 65 #include "mojo/edk/embedder/scoped_ipc_support.h" | 65 #include "mojo/edk/embedder/scoped_ipc_support.h" |
| 66 #include "mojo/public/cpp/system/buffer.h" | 66 #include "mojo/public/cpp/system/buffer.h" |
| 67 #include "mojo/public/cpp/system/platform_handle.h" | 67 #include "mojo/public/cpp/system/platform_handle.h" |
| 68 #include "services/device/public/cpp/power_monitor/power_monitor_broadcast_sourc
e.h" | 68 #include "services/device/public/cpp/power_monitor/power_monitor_broadcast_sourc
e.h" |
| 69 #include "services/device/public/interfaces/constants.mojom.h" | |
| 70 #include "services/resource_coordinator/public/cpp/memory/memory_dump_manager_de
legate_impl.h" | 69 #include "services/resource_coordinator/public/cpp/memory/memory_dump_manager_de
legate_impl.h" |
| 71 #include "services/service_manager/public/cpp/connector.h" | 70 #include "services/service_manager/public/cpp/connector.h" |
| 72 #include "services/service_manager/public/cpp/interface_factory.h" | 71 #include "services/service_manager/public/cpp/interface_factory.h" |
| 73 #include "services/service_manager/public/cpp/interface_provider.h" | 72 #include "services/service_manager/public/cpp/interface_provider.h" |
| 74 #include "services/service_manager/public/cpp/interface_registry.h" | 73 #include "services/service_manager/public/cpp/interface_registry.h" |
| 75 #include "services/service_manager/runner/common/client_util.h" | 74 #include "services/service_manager/runner/common/client_util.h" |
| 76 | 75 |
| 77 #if defined(OS_POSIX) | 76 #if defined(OS_POSIX) |
| 78 #include "base/posix/global_descriptors.h" | 77 #include "base/posix/global_descriptors.h" |
| 79 #include "content/public/common/content_descriptors.h" | 78 #include "content/public/common/content_descriptors.h" |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 memory_instrumentation::MemoryDumpManagerDelegateImpl>(config); | 502 memory_instrumentation::MemoryDumpManagerDelegateImpl>(config); |
| 504 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( | 503 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( |
| 505 std::move(delegate)); | 504 std::move(delegate)); |
| 506 } | 505 } |
| 507 } | 506 } |
| 508 | 507 |
| 509 // In single process mode we may already have a power monitor, | 508 // In single process mode we may already have a power monitor, |
| 510 // also for some edge cases where there is no ServiceManagerConnection, we do | 509 // also for some edge cases where there is no ServiceManagerConnection, we do |
| 511 // not create the power monitor. | 510 // not create the power monitor. |
| 512 if (!base::PowerMonitor::Get() && service_manager_connection_) { | 511 if (!base::PowerMonitor::Get() && service_manager_connection_) { |
| 513 std::unique_ptr<service_manager::Connection> device_connection = | |
| 514 service_manager_connection_->GetConnector()->Connect( | |
| 515 device::mojom::kServiceName); | |
| 516 auto power_monitor_source = | 512 auto power_monitor_source = |
| 517 base::MakeUnique<device::PowerMonitorBroadcastSource>( | 513 base::MakeUnique<device::PowerMonitorBroadcastSource>(GetConnector()); |
| 518 device_connection->GetRemoteInterfaces()); | |
| 519 | |
| 520 power_monitor_.reset( | 514 power_monitor_.reset( |
| 521 new base::PowerMonitor(std::move(power_monitor_source))); | 515 new base::PowerMonitor(std::move(power_monitor_source))); |
| 522 } | 516 } |
| 523 | 517 |
| 524 #if defined(OS_POSIX) | 518 #if defined(OS_POSIX) |
| 525 // Check that --process-type is specified so we don't do this in unit tests | 519 // Check that --process-type is specified so we don't do this in unit tests |
| 526 // and single-process mode. | 520 // and single-process mode. |
| 527 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 521 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
| 528 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 522 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
| 529 #endif | 523 #endif |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 connected_to_browser_ = true; | 870 connected_to_browser_ = true; |
| 877 child_info_ = local_info; | 871 child_info_ = local_info; |
| 878 browser_info_ = remote_info; | 872 browser_info_ = remote_info; |
| 879 } | 873 } |
| 880 | 874 |
| 881 bool ChildThreadImpl::IsInBrowserProcess() const { | 875 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 882 return static_cast<bool>(browser_process_io_runner_); | 876 return static_cast<bool>(browser_process_io_runner_); |
| 883 } | 877 } |
| 884 | 878 |
| 885 } // namespace content | 879 } // namespace content |
| OLD | NEW |