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

Unified Diff: content/browser/memory/memory_coordinator_impl.cc

Issue 2941123004: Remove MemoryCoordinator::CanSuspendRenderer() (Closed)
Patch Set: Fix tests Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/memory/memory_coordinator_impl.cc
diff --git a/content/browser/memory/memory_coordinator_impl.cc b/content/browser/memory/memory_coordinator_impl.cc
index 1f59ea6761bbc23c4f80536aebcd6127d715c8cb..299e0c8472cf4a8b914ca3e2532e5fa510d6b634 100644
--- a/content/browser/memory/memory_coordinator_impl.cc
+++ b/content/browser/memory/memory_coordinator_impl.cc
@@ -213,6 +213,10 @@ bool MemoryCoordinatorImpl::SetChildMemoryState(int render_process_id,
if (memory_state == MemoryState::UNKNOWN)
return false;
+ // SUSPENDED state isn't supported yet.
+ if (memory_state == MemoryState::SUSPENDED)
+ return false;
+
// Can't send a message to a child that doesn't exist.
auto iter = children_.find(render_process_id);
if (iter == children_.end())
@@ -228,11 +232,6 @@ bool MemoryCoordinatorImpl::SetChildMemoryState(int render_process_id,
if (iter->second.memory_state == memory_state)
return true;
- // Can't suspend the given renderer.
- if (memory_state == MemoryState::SUSPENDED &&
- !CanSuspendRenderer(render_process_id))
- return false;
-
// Update the internal state and send the message.
iter->second.memory_state = memory_state;
iter->second.handle->child()->OnStateChange(ToMojomMemoryState(memory_state));
@@ -376,18 +375,6 @@ void MemoryCoordinatorImpl::OnConnectionError(int render_process_id) {
children_.erase(render_process_id);
}
-bool MemoryCoordinatorImpl::CanSuspendRenderer(int render_process_id) {
- auto* render_process_host = GetRenderProcessHost(render_process_id);
- if (!render_process_host || !render_process_host->IsProcessBackgrounded())
- return false;
- if (render_process_host->GetWorkerRefCount() > 0)
- return false;
- // Assumes that we can't suspend renderers if there is no delegate.
- if (!delegate_)
- return false;
- return delegate_->CanSuspendBackgroundedRenderer(render_process_id);
-}
-
void MemoryCoordinatorImpl::OnChildAdded(int render_process_id) {
RenderProcessHost* render_process_host =
GetRenderProcessHost(render_process_id);
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.h ('k') | content/browser/memory/memory_coordinator_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698