| 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 |
| 11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
| 12 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
| 14 #include "base/debug/leak_annotations.h" | 15 #include "base/debug/leak_annotations.h" |
| 15 #include "base/debug/profiler.h" | 16 #include "base/debug/profiler.h" |
| 16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 17 #include "base/location.h" | 18 #include "base/location.h" |
| 18 #include "base/logging.h" | 19 #include "base/logging.h" |
| 19 #include "base/macros.h" | 20 #include "base/macros.h" |
| 20 #include "base/memory/ptr_util.h" | 21 #include "base/memory/ptr_util.h" |
| 21 #include "base/message_loop/timer_slack.h" | 22 #include "base/message_loop/timer_slack.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "ipc/ipc_sync_channel.h" | 61 #include "ipc/ipc_sync_channel.h" |
| 61 #include "ipc/ipc_sync_message_filter.h" | 62 #include "ipc/ipc_sync_message_filter.h" |
| 62 #include "mojo/edk/embedder/embedder.h" | 63 #include "mojo/edk/embedder/embedder.h" |
| 63 #include "mojo/edk/embedder/named_platform_channel_pair.h" | 64 #include "mojo/edk/embedder/named_platform_channel_pair.h" |
| 64 #include "mojo/edk/embedder/platform_channel_pair.h" | 65 #include "mojo/edk/embedder/platform_channel_pair.h" |
| 65 #include "mojo/edk/embedder/scoped_ipc_support.h" | 66 #include "mojo/edk/embedder/scoped_ipc_support.h" |
| 66 #include "mojo/public/cpp/system/buffer.h" | 67 #include "mojo/public/cpp/system/buffer.h" |
| 67 #include "mojo/public/cpp/system/platform_handle.h" | 68 #include "mojo/public/cpp/system/platform_handle.h" |
| 68 #include "services/device/public/cpp/power_monitor/power_monitor_broadcast_sourc
e.h" | 69 #include "services/device/public/cpp/power_monitor/power_monitor_broadcast_sourc
e.h" |
| 69 #include "services/resource_coordinator/public/cpp/memory/process_local_dump_man
ager_impl.h" | 70 #include "services/resource_coordinator/public/cpp/memory/process_local_dump_man
ager_impl.h" |
| 71 #include "services/resource_coordinator/public/cpp/tracing/chrome_agent.h" |
| 72 #include "services/resource_coordinator/public/interfaces/tracing/tracing.mojom.
h" |
| 70 #include "services/service_manager/public/cpp/connector.h" | 73 #include "services/service_manager/public/cpp/connector.h" |
| 71 #include "services/service_manager/public/cpp/interface_provider.h" | 74 #include "services/service_manager/public/cpp/interface_provider.h" |
| 72 #include "services/service_manager/runner/common/client_util.h" | 75 #include "services/service_manager/runner/common/client_util.h" |
| 73 | 76 |
| 74 #if defined(OS_POSIX) | 77 #if defined(OS_POSIX) |
| 75 #include "base/posix/global_descriptors.h" | 78 #include "base/posix/global_descriptors.h" |
| 76 #include "content/public/common/content_descriptors.h" | 79 #include "content/public/common/content_descriptors.h" |
| 77 #endif | 80 #endif |
| 78 | 81 |
| 79 #if defined(OS_MACOSX) | 82 #if defined(OS_MACOSX) |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 478 |
| 476 channel_->AddFilter(histogram_message_filter_.get()); | 479 channel_->AddFilter(histogram_message_filter_.get()); |
| 477 channel_->AddFilter(resource_message_filter_.get()); | 480 channel_->AddFilter(resource_message_filter_.get()); |
| 478 channel_->AddFilter(quota_message_filter_->GetFilter()); | 481 channel_->AddFilter(quota_message_filter_->GetFilter()); |
| 479 channel_->AddFilter(notification_dispatcher_->GetFilter()); | 482 channel_->AddFilter(notification_dispatcher_->GetFilter()); |
| 480 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 483 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
| 481 | 484 |
| 482 if (!IsInBrowserProcess()) { | 485 if (!IsInBrowserProcess()) { |
| 483 // In single process mode, browser-side tracing and memory will cover the | 486 // In single process mode, browser-side tracing and memory will cover the |
| 484 // whole process including renderers. | 487 // whole process including renderers. |
| 485 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 488 // channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 486 ChildProcess::current()->io_task_runner())); | 489 // ChildProcess::current()->io_task_runner())); |
| 487 channel_->AddFilter(new ChildMemoryMessageFilter()); | 490 channel_->AddFilter(new ChildMemoryMessageFilter()); |
| 488 | 491 |
| 489 if (service_manager_connection_) { | 492 if (service_manager_connection_) { |
| 493 resource_coordinator::tracing::mojom::AgentSetPtr agent_set; |
| 494 GetConnector()->BindInterface("tracing", mojo::MakeRequest(&agent_set)); |
| 495 resource_coordinator::tracing::ChromeAgent::InitializeIfNeeded( |
| 496 std::move(agent_set)); |
| 497 |
| 490 memory_instrumentation::ProcessLocalDumpManagerImpl::Config config( | 498 memory_instrumentation::ProcessLocalDumpManagerImpl::Config config( |
| 491 GetConnector(), mojom::kBrowserServiceName); | 499 GetConnector(), mojom::kBrowserServiceName); |
| 492 memory_instrumentation::ProcessLocalDumpManagerImpl::CreateInstance( | 500 memory_instrumentation::ProcessLocalDumpManagerImpl::CreateInstance( |
| 493 config); | 501 config); |
| 494 } | 502 } |
| 495 } | 503 } |
| 496 | 504 |
| 497 // In single process mode we may already have a power monitor, | 505 // In single process mode we may already have a power monitor, |
| 498 // also for some edge cases where there is no ServiceManagerConnection, we do | 506 // also for some edge cases where there is no ServiceManagerConnection, we do |
| 499 // not create the power monitor. | 507 // not create the power monitor. |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 Listener* route = router_.GetRoute(routing_id); | 828 Listener* route = router_.GetRoute(routing_id); |
| 821 if (route) | 829 if (route) |
| 822 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); | 830 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); |
| 823 } | 831 } |
| 824 | 832 |
| 825 bool ChildThreadImpl::IsInBrowserProcess() const { | 833 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 826 return static_cast<bool>(browser_process_io_runner_); | 834 return static_cast<bool>(browser_process_io_runner_); |
| 827 } | 835 } |
| 828 | 836 |
| 829 } // namespace content | 837 } // namespace content |
| OLD | NEW |