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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 std::string UintVectorToString(const std::vector<unsigned>& vector) { | 439 std::string UintVectorToString(const std::vector<unsigned>& vector) { |
442 std::string str; | 440 std::string str; |
443 for (auto it : vector) { | 441 for (auto it : vector) { |
444 if (!str.empty()) | 442 if (!str.empty()) |
445 str += ","; | 443 str += ","; |
446 str += base::UintToString(it); | 444 str += base::UintToString(it); |
447 } | 445 } |
448 return str; | 446 return str; |
449 } | 447 } |
450 | 448 |
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 | |
458 } // namespace | 449 } // namespace |
459 | 450 |
460 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; | 451 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
461 | 452 |
462 base::MessageLoop* g_in_process_thread; | 453 base::MessageLoop* g_in_process_thread; |
463 | 454 |
464 base::MessageLoop* | 455 base::MessageLoop* |
465 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { | 456 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { |
466 return g_in_process_thread; | 457 return g_in_process_thread; |
467 } | 458 } |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 1082 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
1092 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), | 1083 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), |
1093 io_task_runner); | 1084 io_task_runner); |
1094 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), | 1085 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), |
1095 io_task_runner); | 1086 io_task_runner); |
1096 GetInterfaceRegistry()->AddInterface( | 1087 GetInterfaceRegistry()->AddInterface( |
1097 base::Bind(&DeviceOrientationHost::Create), io_task_runner); | 1088 base::Bind(&DeviceOrientationHost::Create), io_task_runner); |
1098 GetInterfaceRegistry()->AddInterface( | 1089 GetInterfaceRegistry()->AddInterface( |
1099 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); | 1090 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); |
1100 | 1091 |
1101 if (memory_coordinator::IsEnabled()) { | |
1102 GetInterfaceRegistry()->AddInterface( | |
1103 base::Bind(&CreateMemoryCoordinatorHandle, GetID())); | |
1104 } | |
1105 | |
1106 #if defined(OS_ANDROID) | 1092 #if defined(OS_ANDROID) |
1107 ServiceRegistrarAndroid::RegisterProcessHostServices( | 1093 ServiceRegistrarAndroid::RegisterProcessHostServices( |
1108 mojo_child_connection_->service_registry_android()); | 1094 mojo_child_connection_->service_registry_android()); |
1109 #endif | 1095 #endif |
1110 | 1096 |
1111 GetContentClient()->browser()->ExposeInterfacesToRenderer( | 1097 GetContentClient()->browser()->ExposeInterfacesToRenderer( |
1112 GetInterfaceRegistry(), this); | 1098 GetInterfaceRegistry(), this); |
1113 } | 1099 } |
1114 | 1100 |
1115 void RenderProcessHostImpl::CreateStoragePartitionService( | 1101 void RenderProcessHostImpl::CreateStoragePartitionService( |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2778 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2793 | 2779 |
2794 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2780 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2795 // enough information here so that we can determine what the bad message was. | 2781 // enough information here so that we can determine what the bad message was. |
2796 base::debug::Alias(&error); | 2782 base::debug::Alias(&error); |
2797 bad_message::ReceivedBadMessage(process.get(), | 2783 bad_message::ReceivedBadMessage(process.get(), |
2798 bad_message::RPH_MOJO_PROCESS_ERROR); | 2784 bad_message::RPH_MOJO_PROCESS_ERROR); |
2799 } | 2785 } |
2800 | 2786 |
2801 } // namespace content | 2787 } // namespace content |
OLD | NEW |