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