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

Unified Diff: content/browser/browser_main_loop.cc

Issue 2565323002: Stop using callbacks in MemoryCoordinatorProxy (Closed)
Patch Set: fix 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/browser_main_loop.cc
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index d7d261bcc51d19d91faab2fb098529c7d4c2e660..90c8b2e6b78d5e4722f6f13a20b5deadba62470e 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -1528,16 +1528,8 @@ 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(
- &MemoryCoordinator::GetCurrentMemoryState,
- base::Unretained(MemoryCoordinator::GetInstance())));
- base::MemoryCoordinatorProxy::GetInstance()->
- SetSetCurrentMemoryStateForTestingCallback(base::Bind(
- &MemoryCoordinator::SetCurrentMemoryStateForTesting,
- base::Unretained(MemoryCoordinator::GetInstance())));
+ base::MemoryCoordinatorProxy::GetInstance()->Set(
+ MemoryCoordinator::GetInstance()->GetWeakPtr());
if (memory_pressure_monitor_) {
memory_pressure_monitor_->SetDispatchCallback(

Powered by Google App Engine
This is Rietveld 408576698