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

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

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
« no previous file with comments | « chrome/browser/chromeos/memory/oom_priority_manager.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/memory/oom_priority_manager.cc
diff --git a/chrome/browser/chromeos/memory/oom_priority_manager.cc b/chrome/browser/chromeos/memory/oom_priority_manager.cc
index 234251fee79f72cefabf5eaa29afc10ac85808a3..b750816a142247561f7c387dfae27ca1e8734b51 100644
--- a/chrome/browser/chromeos/memory/oom_priority_manager.cc
+++ b/chrome/browser/chromeos/memory/oom_priority_manager.cc
@@ -25,7 +25,6 @@
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part_chromeos.h"
-#include "chrome/browser/chromeos/memory/low_memory_observer.h"
#include "chrome/browser/memory_details.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_iterator.h"
@@ -37,6 +36,7 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
+#include "chromeos/memory/low_memory_listener.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -174,7 +174,7 @@ OomPriorityManager::OomPriorityManager()
recent_tab_discard_(false) {
// We only need the low memory observer if we want to discard tabs.
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoDiscardTabs))
- low_memory_observer_.reset(new LowMemoryObserver);
+ low_memory_listener_.reset(new LowMemoryListener(this));
registrar_.Add(this,
content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
@@ -205,16 +205,16 @@ void OomPriorityManager::Start() {
this,
&OomPriorityManager::RecordRecentTabDiscard);
}
- if (low_memory_observer_.get())
- low_memory_observer_->Start();
+ if (low_memory_listener_.get())
+ low_memory_listener_->Start();
start_time_ = TimeTicks::Now();
}
void OomPriorityManager::Stop() {
timer_.Stop();
recent_tab_discard_timer_.Stop();
- if (low_memory_observer_.get())
- low_memory_observer_->Stop();
+ if (low_memory_listener_.get())
+ low_memory_listener_->Stop();
}
std::vector<string16> OomPriorityManager::GetTabTitles() {
@@ -638,4 +638,9 @@ void OomPriorityManager::AdjustOomPrioritiesOnFileThread(
}
}
+void OomPriorityManager::OnMemoryLow() {
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ LogMemoryAndDiscardTab();
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/memory/oom_priority_manager.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698