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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 std::string UintVectorToString(const std::vector<unsigned>& vector) { | 443 std::string UintVectorToString(const std::vector<unsigned>& vector) { |
442 std::string str; | 444 std::string str; |
443 for (auto it : vector) { | 445 for (auto it : vector) { |
444 if (!str.empty()) | 446 if (!str.empty()) |
445 str += ","; | 447 str += ","; |
446 str += base::UintToString(it); | 448 str += base::UintToString(it); |
447 } | 449 } |
448 return str; | 450 return str; |
449 } | 451 } |
450 | 452 |
453 void CreateMemoryCoordinatorHandle( | |
454 int id, | |
dcheng
2016/07/12 07:44:46
Nit: render_process_id
bashi
2016/07/12 08:36:17
Done.
| |
455 memory_coordinator::mojom::MemoryCoordinatorHandleRequest request) { | |
456 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle( | |
457 id, std::move(request)); | |
458 } | |
459 | |
451 } // namespace | 460 } // namespace |
452 | 461 |
453 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; | 462 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
454 | 463 |
455 base::MessageLoop* g_in_process_thread; | 464 base::MessageLoop* g_in_process_thread; |
456 | 465 |
457 base::MessageLoop* | 466 base::MessageLoop* |
458 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { | 467 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { |
459 return g_in_process_thread; | 468 return g_in_process_thread; |
460 } | 469 } |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1084 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); | 1093 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
1085 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), | 1094 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), |
1086 io_task_runner); | 1095 io_task_runner); |
1087 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), | 1096 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), |
1088 io_task_runner); | 1097 io_task_runner); |
1089 GetInterfaceRegistry()->AddInterface( | 1098 GetInterfaceRegistry()->AddInterface( |
1090 base::Bind(&DeviceOrientationHost::Create), io_task_runner); | 1099 base::Bind(&DeviceOrientationHost::Create), io_task_runner); |
1091 GetInterfaceRegistry()->AddInterface( | 1100 GetInterfaceRegistry()->AddInterface( |
1092 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); | 1101 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); |
1093 | 1102 |
1103 if (memory_coordinator::IsEnabled()) { | |
1104 GetInterfaceRegistry()->AddInterface( | |
1105 base::Bind(&CreateMemoryCoordinatorHandle, GetID())); | |
1106 } | |
1107 | |
1094 #if defined(OS_ANDROID) | 1108 #if defined(OS_ANDROID) |
1095 ServiceRegistrarAndroid::RegisterProcessHostServices( | 1109 ServiceRegistrarAndroid::RegisterProcessHostServices( |
1096 mojo_child_connection_->service_registry_android()); | 1110 mojo_child_connection_->service_registry_android()); |
1097 #endif | 1111 #endif |
1098 | 1112 |
1099 GetContentClient()->browser()->ExposeInterfacesToRenderer( | 1113 GetContentClient()->browser()->ExposeInterfacesToRenderer( |
1100 GetInterfaceRegistry(), this); | 1114 GetInterfaceRegistry(), this); |
1101 } | 1115 } |
1102 | 1116 |
1103 void RenderProcessHostImpl::CreateStoragePartitionService( | 1117 void RenderProcessHostImpl::CreateStoragePartitionService( |
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2760 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 2774 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
2761 | 2775 |
2762 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 2776 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
2763 // enough information here so that we can determine what the bad message was. | 2777 // enough information here so that we can determine what the bad message was. |
2764 base::debug::Alias(&error); | 2778 base::debug::Alias(&error); |
2765 bad_message::ReceivedBadMessage(process.get(), | 2779 bad_message::ReceivedBadMessage(process.get(), |
2766 bad_message::RPH_MOJO_PROCESS_ERROR); | 2780 bad_message::RPH_MOJO_PROCESS_ERROR); |
2767 } | 2781 } |
2768 | 2782 |
2769 } // namespace content | 2783 } // namespace content |
OLD | NEW |