| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "base/strings/stringprintf.h" | 37 #include "base/strings/stringprintf.h" |
| 38 #include "base/supports_user_data.h" | 38 #include "base/supports_user_data.h" |
| 39 #include "base/sys_info.h" | 39 #include "base/sys_info.h" |
| 40 #include "base/threading/thread.h" | 40 #include "base/threading/thread.h" |
| 41 #include "base/threading/thread_restrictions.h" | 41 #include "base/threading/thread_restrictions.h" |
| 42 #include "base/threading/thread_task_runner_handle.h" | 42 #include "base/threading/thread_task_runner_handle.h" |
| 43 #include "base/trace_event/trace_event.h" | 43 #include "base/trace_event/trace_event.h" |
| 44 #include "base/tracked_objects.h" | 44 #include "base/tracked_objects.h" |
| 45 #include "build/build_config.h" | 45 #include "build/build_config.h" |
| 46 #include "cc/base/switches.h" | 46 #include "cc/base/switches.h" |
| 47 #include "components/memory_coordinator/browser/memory_coordinator.h" |
| 48 #include "components/memory_coordinator/common/memory_coordinator_features.h" |
| 47 #include "components/scheduler/common/scheduler_switches.h" | 49 #include "components/scheduler/common/scheduler_switches.h" |
| 48 #include "components/tracing/common/tracing_switches.h" | 50 #include "components/tracing/common/tracing_switches.h" |
| 49 #include "components/webmessaging/broadcast_channel_provider.h" | 51 #include "components/webmessaging/broadcast_channel_provider.h" |
| 50 #include "content/browser/appcache/appcache_dispatcher_host.h" | 52 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 51 #include "content/browser/appcache/chrome_appcache_service.h" | 53 #include "content/browser/appcache/chrome_appcache_service.h" |
| 52 #include "content/browser/background_sync/background_sync_service_impl.h" | 54 #include "content/browser/background_sync/background_sync_service_impl.h" |
| 53 #include "content/browser/bad_message.h" | 55 #include "content/browser/bad_message.h" |
| 54 #include "content/browser/blob_storage/blob_dispatcher_host.h" | 56 #include "content/browser/blob_storage/blob_dispatcher_host.h" |
| 55 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 57 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 56 #include "content/browser/browser_child_process_host_impl.h" | 58 #include "content/browser/browser_child_process_host_impl.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 std::string UintVectorToString(const std::vector<unsigned>& vector) { | 441 std::string UintVectorToString(const std::vector<unsigned>& vector) { |
| 440 std::string str; | 442 std::string str; |
| 441 for (auto it : vector) { | 443 for (auto it : vector) { |
| 442 if (!str.empty()) | 444 if (!str.empty()) |
| 443 str += ","; | 445 str += ","; |
| 444 str += base::UintToString(it); | 446 str += base::UintToString(it); |
| 445 } | 447 } |
| 446 return str; | 448 return str; |
| 447 } | 449 } |
| 448 | 450 |
| 451 void CreateMemoryCoordinatorHandle( |
| 452 int render_process_id, |
| 453 memory_coordinator::mojom::MemoryCoordinatorHandleRequest request) { |
| 454 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle( |
| 455 render_process_id, std::move(request)); |
| 456 } |
| 457 |
| 449 } // namespace | 458 } // namespace |
| 450 | 459 |
| 451 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; | 460 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
| 452 | 461 |
| 453 base::MessageLoop* g_in_process_thread; | 462 base::MessageLoop* g_in_process_thread; |
| 454 | 463 |
| 455 base::MessageLoop* | 464 base::MessageLoop* |
| 456 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { | 465 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { |
| 457 return g_in_process_thread; | 466 return g_in_process_thread; |
| 458 } | 467 } |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 1091 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
| 1083 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), | 1092 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), |
| 1084 io_task_runner); | 1093 io_task_runner); |
| 1085 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), | 1094 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), |
| 1086 io_task_runner); | 1095 io_task_runner); |
| 1087 GetInterfaceRegistry()->AddInterface( | 1096 GetInterfaceRegistry()->AddInterface( |
| 1088 base::Bind(&DeviceOrientationHost::Create), io_task_runner); | 1097 base::Bind(&DeviceOrientationHost::Create), io_task_runner); |
| 1089 GetInterfaceRegistry()->AddInterface( | 1098 GetInterfaceRegistry()->AddInterface( |
| 1090 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); | 1099 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); |
| 1091 | 1100 |
| 1101 if (memory_coordinator::IsEnabled()) { |
| 1102 GetInterfaceRegistry()->AddInterface( |
| 1103 base::Bind(&CreateMemoryCoordinatorHandle, GetID())); |
| 1104 } |
| 1105 |
| 1092 #if defined(OS_ANDROID) | 1106 #if defined(OS_ANDROID) |
| 1093 ServiceRegistrarAndroid::RegisterProcessHostServices( | 1107 ServiceRegistrarAndroid::RegisterProcessHostServices( |
| 1094 mojo_child_connection_->service_registry_android()); | 1108 mojo_child_connection_->service_registry_android()); |
| 1095 #endif | 1109 #endif |
| 1096 | 1110 |
| 1097 GetContentClient()->browser()->ExposeInterfacesToRenderer( | 1111 GetContentClient()->browser()->ExposeInterfacesToRenderer( |
| 1098 GetInterfaceRegistry(), this); | 1112 GetInterfaceRegistry(), this); |
| 1099 } | 1113 } |
| 1100 | 1114 |
| 1101 void RenderProcessHostImpl::CreateStoragePartitionService( | 1115 void RenderProcessHostImpl::CreateStoragePartitionService( |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2792 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 2779 | 2793 |
| 2780 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2794 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 2781 // enough information here so that we can determine what the bad message was. | 2795 // enough information here so that we can determine what the bad message was. |
| 2782 base::debug::Alias(&error); | 2796 base::debug::Alias(&error); |
| 2783 bad_message::ReceivedBadMessage(process.get(), | 2797 bad_message::ReceivedBadMessage(process.get(), |
| 2784 bad_message::RPH_MOJO_PROCESS_ERROR); | 2798 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 2785 } | 2799 } |
| 2786 | 2800 |
| 2787 } // namespace content | 2801 } // namespace content |
| OLD | NEW |