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

Unified Diff: content/browser/browser_main_loop.cc

Issue 2703743002: Refactor MemoryCoordinatorProxy (Closed)
Patch Set: Remove atomics Created 3 years, 10 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
« no previous file with comments | « base/memory/memory_coordinator_proxy.cc ('k') | content/browser/memory/memory_coordinator_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 1a4836241fbe8e0fbb16f948e26cad2d637359cb..a4e0e2b16baa492af82bd93992391816291a429f 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -1618,21 +1618,11 @@ void BrowserMainLoop::InitializeMemoryManagementComponent() {
if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) {
// Disable MemoryPressureListener when memory coordinator is enabled.
base::MemoryPressureListener::SetNotificationsSuppressed(true);
- // base::Unretained is safe because the lifetime of MemoryCoordinator is
- // tied to the lifetime of the browser process.
- base::MemoryCoordinatorProxy::GetInstance()->
- SetGetCurrentMemoryStateCallback(base::Bind(
- &MemoryCoordinatorImpl::GetCurrentMemoryState,
- base::Unretained(MemoryCoordinatorImpl::GetInstance())));
- base::MemoryCoordinatorProxy::GetInstance()->
- SetSetCurrentMemoryStateForTestingCallback(base::Bind(
- &MemoryCoordinatorImpl::SetCurrentMemoryStateForTesting,
- base::Unretained(MemoryCoordinatorImpl::GetInstance())));
-
+ auto* coordinator = MemoryCoordinatorImpl::GetInstance();
if (memory_pressure_monitor_) {
memory_pressure_monitor_->SetDispatchCallback(
base::Bind(&MemoryCoordinatorImpl::RecordMemoryPressure,
- base::Unretained(MemoryCoordinatorImpl::GetInstance())));
+ base::Unretained(coordinator)));
}
}
}
« no previous file with comments | « base/memory/memory_coordinator_proxy.cc ('k') | content/browser/memory/memory_coordinator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698