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

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

Issue 14727005: Moves LowMemoryObserver into chromeos and renames (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review feedback again Created 7 years, 8 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: 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 23e956a67483c7e1868f4730e94fb35336ea8cc8..59f072b16baf9e68451f29d4621c7964616db7d9 100644
--- a/chrome/browser/chromeos/memory/oom_priority_manager.h
+++ b/chrome/browser/chromeos/memory/oom_priority_manager.h
@@ -16,6 +16,7 @@
#include "base/synchronization/lock.h"
#include "base/time.h"
#include "base/timer.h"
+#include "chromeos/memory/low_memory_listener_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -23,7 +24,7 @@ class GURL;
namespace chromeos {
-class LowMemoryObserver;
+class LowMemoryListener;
// The OomPriorityManager periodically checks (see
// ADJUSTMENT_INTERVAL_SECONDS in the source) the status of renderers
@@ -34,7 +35,8 @@ class LowMemoryObserver;
//
// The algorithm used favors killing tabs that are not selected, not pinned,
// and have been idle for longest, in that order of priority.
-class OomPriorityManager : public content::NotificationObserver {
+class OomPriorityManager : public content::NotificationObserver,
+ public LowMemoryListenerDelegate {
public:
OomPriorityManager();
virtual ~OomPriorityManager();
@@ -121,10 +123,14 @@ class OomPriorityManager : public content::NotificationObserver {
static bool CompareTabStats(TabStats first, TabStats second);
+ // NotificationObserver overrides:
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // LowMemoryListenerDelegate overrides:
+ virtual void OnMemoryLow() OVERRIDE;
+
base::RepeatingTimer<OomPriorityManager> timer_;
base::OneShotTimer<OomPriorityManager> focus_tab_score_adjust_timer_;
base::RepeatingTimer<OomPriorityManager> recent_tab_discard_timer_;
@@ -139,7 +145,7 @@ class OomPriorityManager : public content::NotificationObserver {
// Observer for the kernel low memory signal. NULL if tab discarding is
// disabled.
- scoped_ptr<LowMemoryObserver> low_memory_observer_;
+ scoped_ptr<LowMemoryListener> low_memory_listener_;
// Wall-clock time when the priority manager started running.
base::TimeTicks start_time_;
« no previous file with comments | « chrome/browser/chromeos/memory/low_memory_observer.cc ('k') | chrome/browser/chromeos/memory/oom_priority_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698