| 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_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/resource_coordinator/public/cpp/memory/process_local_dump_man
ager_impl.h" | 69 #include "services/resource_coordinator/public/cpp/memory/process_local_dump_man
ager_impl.h" |
| 70 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume
ntation.mojom.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_provider.h" | 72 #include "services/service_manager/public/cpp/interface_provider.h" |
| 72 #include "services/service_manager/runner/common/client_util.h" | 73 #include "services/service_manager/runner/common/client_util.h" |
| 73 | 74 |
| 74 #if defined(OS_POSIX) | 75 #if defined(OS_POSIX) |
| 75 #include "base/posix/global_descriptors.h" | 76 #include "base/posix/global_descriptors.h" |
| 76 #include "content/public/common/content_descriptors.h" | 77 #include "content/public/common/content_descriptors.h" |
| 77 #endif | 78 #endif |
| 78 | 79 |
| 79 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 channel_->AddFilter(service_worker_message_filter_->GetFilter()); | 481 channel_->AddFilter(service_worker_message_filter_->GetFilter()); |
| 481 | 482 |
| 482 if (!IsInBrowserProcess()) { | 483 if (!IsInBrowserProcess()) { |
| 483 // In single process mode, browser-side tracing and memory will cover the | 484 // In single process mode, browser-side tracing and memory will cover the |
| 484 // whole process including renderers. | 485 // whole process including renderers. |
| 485 channel_->AddFilter(new tracing::ChildTraceMessageFilter( | 486 channel_->AddFilter(new tracing::ChildTraceMessageFilter( |
| 486 ChildProcess::current()->io_task_runner())); | 487 ChildProcess::current()->io_task_runner())); |
| 487 channel_->AddFilter(new ChildMemoryMessageFilter()); | 488 channel_->AddFilter(new ChildMemoryMessageFilter()); |
| 488 | 489 |
| 489 if (service_manager_connection_) { | 490 if (service_manager_connection_) { |
| 491 std::string process_type_str = |
| 492 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 493 switches::kProcessType); |
| 494 auto process_type = memory_instrumentation::mojom::ProcessType::OTHER; |
| 495 if (process_type_str == switches::kRendererProcess) |
| 496 process_type = memory_instrumentation::mojom::ProcessType::RENDERER; |
| 497 else if (process_type_str == switches::kGpuProcess) |
| 498 process_type = memory_instrumentation::mojom::ProcessType::GPU; |
| 499 else if (process_type_str == switches::kUtilityProcess) |
| 500 process_type = memory_instrumentation::mojom::ProcessType::UTILITY; |
| 501 else if (process_type_str == switches::kPpapiPluginProcess) |
| 502 process_type = memory_instrumentation::mojom::ProcessType::PLUGIN; |
| 503 |
| 490 memory_instrumentation::ProcessLocalDumpManagerImpl::Config config( | 504 memory_instrumentation::ProcessLocalDumpManagerImpl::Config config( |
| 491 GetConnector(), mojom::kBrowserServiceName); | 505 GetConnector(), mojom::kBrowserServiceName, process_type); |
| 492 memory_instrumentation::ProcessLocalDumpManagerImpl::CreateInstance( | 506 memory_instrumentation::ProcessLocalDumpManagerImpl::CreateInstance( |
| 493 config); | 507 config); |
| 494 } | 508 } |
| 495 } | 509 } |
| 496 | 510 |
| 497 // In single process mode we may already have a power monitor, | 511 // In single process mode we may already have a power monitor, |
| 498 // also for some edge cases where there is no ServiceManagerConnection, we do | 512 // also for some edge cases where there is no ServiceManagerConnection, we do |
| 499 // not create the power monitor. | 513 // not create the power monitor. |
| 500 if (!base::PowerMonitor::Get() && service_manager_connection_) { | 514 if (!base::PowerMonitor::Get() && service_manager_connection_) { |
| 501 auto power_monitor_source = | 515 auto power_monitor_source = |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 Listener* route = router_.GetRoute(routing_id); | 834 Listener* route = router_.GetRoute(routing_id); |
| 821 if (route) | 835 if (route) |
| 822 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); | 836 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); |
| 823 } | 837 } |
| 824 | 838 |
| 825 bool ChildThreadImpl::IsInBrowserProcess() const { | 839 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 826 return static_cast<bool>(browser_process_io_runner_); | 840 return static_cast<bool>(browser_process_io_runner_); |
| 827 } | 841 } |
| 828 | 842 |
| 829 } // namespace content | 843 } // namespace content |
| OLD | NEW |