| 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" | |
| 49 #include "components/scheduler/common/scheduler_switches.h" | 47 #include "components/scheduler/common/scheduler_switches.h" |
| 50 #include "components/tracing/common/tracing_switches.h" | 48 #include "components/tracing/common/tracing_switches.h" |
| 51 #include "components/webmessaging/broadcast_channel_provider.h" | 49 #include "components/webmessaging/broadcast_channel_provider.h" |
| 52 #include "content/browser/appcache/appcache_dispatcher_host.h" | 50 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 53 #include "content/browser/appcache/chrome_appcache_service.h" | 51 #include "content/browser/appcache/chrome_appcache_service.h" |
| 54 #include "content/browser/background_sync/background_sync_service_impl.h" | 52 #include "content/browser/background_sync/background_sync_service_impl.h" |
| 55 #include "content/browser/bad_message.h" | 53 #include "content/browser/bad_message.h" |
| 56 #include "content/browser/blob_storage/blob_dispatcher_host.h" | 54 #include "content/browser/blob_storage/blob_dispatcher_host.h" |
| 57 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 55 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 58 #include "content/browser/browser_child_process_host_impl.h" | 56 #include "content/browser/browser_child_process_host_impl.h" |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 std::string UintVectorToString(const std::vector<unsigned>& vector) { | 443 std::string UintVectorToString(const std::vector<unsigned>& vector) { |
| 446 std::string str; | 444 std::string str; |
| 447 for (auto it : vector) { | 445 for (auto it : vector) { |
| 448 if (!str.empty()) | 446 if (!str.empty()) |
| 449 str += ","; | 447 str += ","; |
| 450 str += base::UintToString(it); | 448 str += base::UintToString(it); |
| 451 } | 449 } |
| 452 return str; | 450 return str; |
| 453 } | 451 } |
| 454 | 452 |
| 455 void CreateMemoryCoordinatorHandle( | |
| 456 int render_process_id, | |
| 457 memory_coordinator::mojom::MemoryCoordinatorHandleRequest request) { | |
| 458 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle( | |
| 459 render_process_id, std::move(request)); | |
| 460 } | |
| 461 | |
| 462 } // namespace | 453 } // namespace |
| 463 | 454 |
| 464 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; | 455 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
| 465 | 456 |
| 466 base::MessageLoop* g_in_process_thread; | 457 base::MessageLoop* g_in_process_thread; |
| 467 | 458 |
| 468 base::MessageLoop* | 459 base::MessageLoop* |
| 469 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { | 460 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { |
| 470 return g_in_process_thread; | 461 return g_in_process_thread; |
| 471 } | 462 } |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 1092 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
| 1102 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), | 1093 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), |
| 1103 io_task_runner); | 1094 io_task_runner); |
| 1104 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), | 1095 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), |
| 1105 io_task_runner); | 1096 io_task_runner); |
| 1106 GetInterfaceRegistry()->AddInterface( | 1097 GetInterfaceRegistry()->AddInterface( |
| 1107 base::Bind(&DeviceOrientationHost::Create), io_task_runner); | 1098 base::Bind(&DeviceOrientationHost::Create), io_task_runner); |
| 1108 GetInterfaceRegistry()->AddInterface( | 1099 GetInterfaceRegistry()->AddInterface( |
| 1109 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); | 1100 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); |
| 1110 | 1101 |
| 1111 if (memory_coordinator::IsEnabled()) { | |
| 1112 GetInterfaceRegistry()->AddInterface( | |
| 1113 base::Bind(&CreateMemoryCoordinatorHandle, GetID())); | |
| 1114 } | |
| 1115 | |
| 1116 #if defined(OS_ANDROID) | 1102 #if defined(OS_ANDROID) |
| 1117 ServiceRegistrarAndroid::RegisterProcessHostServices( | 1103 ServiceRegistrarAndroid::RegisterProcessHostServices( |
| 1118 mojo_child_connection_->service_registry_android()); | 1104 mojo_child_connection_->service_registry_android()); |
| 1119 #endif | 1105 #endif |
| 1120 | 1106 |
| 1121 GetContentClient()->browser()->ExposeInterfacesToRenderer( | 1107 GetContentClient()->browser()->ExposeInterfacesToRenderer( |
| 1122 GetInterfaceRegistry(), this); | 1108 GetInterfaceRegistry(), this); |
| 1123 } | 1109 } |
| 1124 | 1110 |
| 1125 void RenderProcessHostImpl::CreateStoragePartitionService( | 1111 void RenderProcessHostImpl::CreateStoragePartitionService( |
| (...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2801 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2787 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
| 2802 | 2788 |
| 2803 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2789 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
| 2804 // enough information here so that we can determine what the bad message was. | 2790 // enough information here so that we can determine what the bad message was. |
| 2805 base::debug::Alias(&error); | 2791 base::debug::Alias(&error); |
| 2806 bad_message::ReceivedBadMessage(process.get(), | 2792 bad_message::ReceivedBadMessage(process.get(), |
| 2807 bad_message::RPH_MOJO_PROCESS_ERROR); | 2793 bad_message::RPH_MOJO_PROCESS_ERROR); |
| 2808 } | 2794 } |
| 2809 | 2795 |
| 2810 } // namespace content | 2796 } // namespace content |
| OLD | NEW |