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

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

Issue 2376233005: [NotForReview] An idea for experimenting purge & suspend (Closed)
Patch Set: Created 4 years, 2 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
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 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 GetID())); 1258 GetID()));
1259 AddUIThreadInterface( 1259 AddUIThreadInterface(
1260 registry.get(), 1260 registry.get(),
1261 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService, 1261 base::Bind(&RenderProcessHostImpl::CreateStoragePartitionService,
1262 base::Unretained(this))); 1262 base::Unretained(this)));
1263 AddUIThreadInterface( 1263 AddUIThreadInterface(
1264 registry.get(), 1264 registry.get(),
1265 base::Bind(&BroadcastChannelProvider::Connect, 1265 base::Bind(&BroadcastChannelProvider::Connect,
1266 base::Unretained( 1266 base::Unretained(
1267 storage_partition_impl_->GetBroadcastChannelProvider()))); 1267 storage_partition_impl_->GetBroadcastChannelProvider())));
1268 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) { 1268 if (MemoryCoordinator::IsEnabled()) {
1269 AddUIThreadInterface( 1269 AddUIThreadInterface(
1270 registry.get(), base::Bind(&CreateMemoryCoordinatorHandle, GetID())); 1270 registry.get(), base::Bind(&CreateMemoryCoordinatorHandle, GetID()));
1271 } 1271 }
1272 1272
1273 // BrowserMainLoop, which owns TimeZoneMonitor, is alive for the lifetime of 1273 // BrowserMainLoop, which owns TimeZoneMonitor, is alive for the lifetime of
1274 // Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(), 1274 // Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(),
1275 // which shuts down Mojo). Hence, passing that TimeZoneMonitor instance as 1275 // which shuts down Mojo). Hence, passing that TimeZoneMonitor instance as
1276 // a raw pointer here is safe. 1276 // a raw pointer here is safe.
1277 AddUIThreadInterface( 1277 AddUIThreadInterface(
1278 registry.get(), 1278 registry.get(),
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 shared_worker_ref_count_ = 0; 1427 shared_worker_ref_count_ = 0;
1428 Cleanup(); 1428 Cleanup();
1429 } 1429 }
1430 1430
1431 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() { 1431 bool RenderProcessHostImpl::IsWorkerRefCountDisabled() {
1432 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1432 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1433 return is_worker_ref_count_disabled_; 1433 return is_worker_ref_count_disabled_;
1434 } 1434 }
1435 1435
1436 void RenderProcessHostImpl::PurgeAndSuspend() { 1436 void RenderProcessHostImpl::PurgeAndSuspend() {
1437 Send(new ChildProcessMsg_PurgeAndSuspend()); 1437 if (base::FeatureList::IsEnabled(features::kPurgeAndSuspend)) {
1438 MemoryCoordinator::GetInstance()->PurgeAndSuspendChild(GetID());
1439 } else {
1440 Send(new ChildProcessMsg_PurgeAndSuspend());
1441 }
1438 } 1442 }
1439 1443
1440 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { 1444 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() {
1441 if (!remote_route_provider_) { 1445 if (!remote_route_provider_) {
1442 DCHECK(channel_); 1446 DCHECK(channel_);
1443 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); 1447 channel_->GetRemoteAssociatedInterface(&remote_route_provider_);
1444 } 1448 }
1445 return remote_route_provider_.get(); 1449 return remote_route_provider_.get();
1446 } 1450 }
1447 1451
(...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after
3042 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3046 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3043 3047
3044 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3048 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3045 // enough information here so that we can determine what the bad message was. 3049 // enough information here so that we can determine what the bad message was.
3046 base::debug::Alias(&error); 3050 base::debug::Alias(&error);
3047 bad_message::ReceivedBadMessage(process.get(), 3051 bad_message::ReceivedBadMessage(process.get(),
3048 bad_message::RPH_MOJO_PROCESS_ERROR); 3052 bad_message::RPH_MOJO_PROCESS_ERROR);
3049 } 3053 }
3050 3054
3051 } // namespace content 3055 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/memory/memory_coordinator.cc ('k') | content/child/memory/child_memory_coordinator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698