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

Unified Diff: chrome/browser/chromeos/memory/oom_priority_manager.h

Issue 815183002: Using the new MemoryPressureListener instead of the LowMemoryObserver when the enhanced memory mana… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Created 6 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: chrome/browser/chromeos/memory/oom_priority_manager.h
diff --git a/chrome/browser/chromeos/memory/oom_priority_manager.h b/chrome/browser/chromeos/memory/oom_priority_manager.h
index 92ef696fe9763591bfd8ed65d45e4247e9f93bf9..d50b1c12dd3c00a624eee88fc151b66fa59916bc 100644
--- a/chrome/browser/chromeos/memory/oom_priority_manager.h
+++ b/chrome/browser/chromeos/memory/oom_priority_manager.h
@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/gtest_prod_util.h"
+#include "base/memory/memory_pressure_listener.h"
#include "base/memory/scoped_ptr.h"
#include "base/process/process.h"
#include "base/strings/string16.h"
@@ -138,6 +139,10 @@ class OomPriorityManager : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
+ // Called by the memory pressure listener when the memory pressure rises.
+ void OnMemoryPressure(
+ base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
+
base::RepeatingTimer<OomPriorityManager> timer_;
base::OneShotTimer<OomPriorityManager> focus_tab_score_adjust_timer_;
base::RepeatingTimer<OomPriorityManager> recent_tab_discard_timer_;
@@ -151,10 +156,17 @@ class OomPriorityManager : public content::NotificationObserver {
// Holds the focused tab's child process host id.
ProcessInfo focused_tab_process_info_;
- // Observer for the kernel low memory signal. NULL if tab discarding is
- // disabled.
+ // The old observer for the kernel low memory signal. This is null if
+ // the new MemoryPressureListener is used.
+ // TODO(skuhne): Remove this when the enhanced memory observer is turned on
+ // by default.
scoped_ptr<LowMemoryObserver> low_memory_observer_;
+ // A listener to global memory pressure events. This will be used if the
+ // memory pressure system was instantiated - otherwise the LowMemoryObserver
+ // will be used.
+ scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
+
// Wall-clock time when the priority manager started running.
base::TimeTicks start_time_;

Powered by Google App Engine
This is Rietveld 408576698