Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2149413002: Re-reland: Add MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Always pass MemoryCoordinatorHandlePtr Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/memory/memory_coordinator_browsertest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 std::string UintVectorToString(const std::vector<unsigned>& vector) { 446 std::string UintVectorToString(const std::vector<unsigned>& vector) {
445 std::string str; 447 std::string str;
446 for (auto it : vector) { 448 for (auto it : vector) {
447 if (!str.empty()) 449 if (!str.empty())
448 str += ","; 450 str += ",";
449 str += base::UintToString(it); 451 str += base::UintToString(it);
450 } 452 }
451 return str; 453 return str;
452 } 454 }
453 455
456 void CreateMemoryCoordinatorHandle(
457 int render_process_id,
458 memory_coordinator::mojom::MemoryCoordinatorHandleRequest request) {
459 BrowserMainLoop::GetInstance()->memory_coordinator()->CreateHandle(
460 render_process_id, std::move(request));
461 }
462
454 } // namespace 463 } // namespace
455 464
456 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; 465 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL;
457 466
458 base::MessageLoop* g_in_process_thread; 467 base::MessageLoop* g_in_process_thread;
459 468
460 base::MessageLoop* 469 base::MessageLoop*
461 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { 470 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() {
462 return g_in_process_thread; 471 return g_in_process_thread;
463 } 472 }
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); 1102 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
1094 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create), 1103 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceLightHost::Create),
1095 io_task_runner); 1104 io_task_runner);
1096 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create), 1105 GetInterfaceRegistry()->AddInterface(base::Bind(&DeviceMotionHost::Create),
1097 io_task_runner); 1106 io_task_runner);
1098 GetInterfaceRegistry()->AddInterface( 1107 GetInterfaceRegistry()->AddInterface(
1099 base::Bind(&DeviceOrientationHost::Create), io_task_runner); 1108 base::Bind(&DeviceOrientationHost::Create), io_task_runner);
1100 GetInterfaceRegistry()->AddInterface( 1109 GetInterfaceRegistry()->AddInterface(
1101 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner); 1110 base::Bind(&DeviceOrientationAbsoluteHost::Create), io_task_runner);
1102 1111
1112 if (memory_coordinator::IsEnabled()) {
1113 GetInterfaceRegistry()->AddInterface(
1114 base::Bind(&CreateMemoryCoordinatorHandle, GetID()));
1115 }
1116
1103 #if defined(OS_ANDROID) 1117 #if defined(OS_ANDROID)
1104 ServiceRegistrarAndroid::RegisterProcessHostServices( 1118 ServiceRegistrarAndroid::RegisterProcessHostServices(
1105 mojo_child_connection_->service_registry_android()); 1119 mojo_child_connection_->service_registry_android());
1106 #endif 1120 #endif
1107 1121
1108 GetContentClient()->browser()->ExposeInterfacesToRenderer( 1122 GetContentClient()->browser()->ExposeInterfacesToRenderer(
1109 GetInterfaceRegistry(), this); 1123 GetInterfaceRegistry(), this);
1110 } 1124 }
1111 1125
1112 void RenderProcessHostImpl::CreateStoragePartitionService( 1126 void RenderProcessHostImpl::CreateStoragePartitionService(
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2796 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2783 2797
2784 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2798 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2785 // enough information here so that we can determine what the bad message was. 2799 // enough information here so that we can determine what the bad message was.
2786 base::debug::Alias(&error); 2800 base::debug::Alias(&error);
2787 bad_message::ReceivedBadMessage(process.get(), 2801 bad_message::ReceivedBadMessage(process.get(),
2788 bad_message::RPH_MOJO_PROCESS_ERROR); 2802 bad_message::RPH_MOJO_PROCESS_ERROR);
2789 } 2803 }
2790 2804
2791 } // namespace content 2805 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/memory/memory_coordinator_browsertest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698