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

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

Issue 2553553002: memory coordinator: Throttle foreground renderers on SUSPENDED state (Closed)
Patch Set: Fix unittests Created 4 years 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 27b222e636c3499cdcb4311b9880130600408c10..eec151435c58da4f48adc6c3d098ab85b17da1ef 100644
--- a/content/browser/memory/memory_coordinator_impl.cc
+++ b/content/browser/memory/memory_coordinator_impl.cc
@@ -185,7 +185,8 @@ void MemoryCoordinatorImpl::Start() {
void MemoryCoordinatorImpl::OnChildAdded(int render_process_id) {
// Populate the global state as an initial state of a newly created process.
- SetChildMemoryState(render_process_id, ToMojomMemoryState(current_state_));
+ auto new_state = ToMojomMemoryState(GetGlobalMemoryState());
+ SetChildMemoryState(render_process_id, new_state);
}
base::MemoryState MemoryCoordinatorImpl::GetGlobalMemoryState() const {
@@ -224,10 +225,8 @@ void MemoryCoordinatorImpl::Observe(int type,
auto iter = children().find(process->GetID());
if (iter == children().end())
return;
- bool is_visible = *Details<bool>(details).ptr();
- // We don't throttle/suspend a visible renderer for now.
- auto new_state = is_visible ? mojom::MemoryState::NORMAL
- : ToMojomMemoryState(current_state_);
+ iter->second.is_visible = *Details<bool>(details).ptr();
+ auto new_state = ToMojomMemoryState(GetGlobalMemoryState());
SetChildMemoryState(iter->first, new_state);
}
« no previous file with comments | « content/browser/memory/memory_coordinator_browsertest.cc ('k') | content/browser/memory/memory_coordinator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698