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

Unified Diff: components/memory_coordinator/browser/memory_coordinator.cc

Issue 2180843004: Use MemoryPressureListener in MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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: components/memory_coordinator/browser/memory_coordinator.cc
diff --git a/components/memory_coordinator/browser/memory_coordinator.cc b/components/memory_coordinator/browser/memory_coordinator.cc
index b4e714ab731798c73d0b27712b3ae1a1442356a6..9291fd00f9a042270315839ea7146d3ae899a6fa 100644
--- a/components/memory_coordinator/browser/memory_coordinator.cc
+++ b/components/memory_coordinator/browser/memory_coordinator.cc
@@ -4,8 +4,6 @@
#include "components/memory_coordinator/browser/memory_coordinator.h"
-#include "base/memory/memory_pressure_listener.h"
-
namespace memory_coordinator {
// The implementation of MemoryCoordinatorHandle. See memory_coordinator.mojom
@@ -34,22 +32,11 @@ class MemoryCoordinatorHandleImpl : public mojom::MemoryCoordinatorHandle {
};
MemoryCoordinator::MemoryCoordinator()
- : pressure_level_dispatcher_(
+ : pressure_listener_(
base::Bind(&MemoryCoordinator::OnMemoryPressure,
- base::Unretained(this))) {
- auto* monitor = base::MemoryPressureMonitor::Get();
- if (monitor) {
- monitor->SetDispatchCallback(pressure_level_dispatcher_);
- }
-}
+ base::Unretained(this))) {}
-MemoryCoordinator::~MemoryCoordinator() {
- auto* monitor = base::MemoryPressureMonitor::Get();
- if (monitor) {
- monitor->SetDispatchCallback(
- base::Bind(&base::MemoryPressureListener::NotifyMemoryPressure));
- }
-}
+MemoryCoordinator::~MemoryCoordinator() {}
void MemoryCoordinator::CreateHandle(
int render_process_id,
@@ -70,7 +57,7 @@ void MemoryCoordinator::OnConnectionError(int render_process_id) {
}
void MemoryCoordinator::OnMemoryPressure(
- base::MemoryPressureMonitor::MemoryPressureLevel level) {
+ base::MemoryPressureListener::MemoryPressureLevel level) {
// TODO(bashi): The current implementation just translates memory pressure
// levels to memory coordinator states. The logic will be replaced with
// the priority tracker.

Powered by Google App Engine
This is Rietveld 408576698