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 |