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

Unified Diff: content/browser/browser_main_loop.cc

Issue 2434353003: Introduce MemoryCoordinatorProxy in base (Closed)
Patch Set: Address on reviews 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 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 d769c3969a502d9cdc0040954fe9c27054b59171..02b0a5714686eac96ae977e7d293c1f0416373f0 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -16,6 +16,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/memory_coordinator_proxy.h"
#include "base/memory/memory_pressure_monitor.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
@@ -1393,6 +1394,12 @@ 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())));
return;
}

Powered by Google App Engine
This is Rietveld 408576698