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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 12817: A new copy of the old system monitor changelist. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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/safe_browsing/safe_browsing_service.h ('k') | chrome/browser/suspend_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/safe_browsing_service.cc
===================================================================
--- chrome/browser/safe_browsing/safe_browsing_service.cc (revision 6119)
+++ chrome/browser/safe_browsing/safe_browsing_service.cc (working copy)
@@ -12,6 +12,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/safe_browsing/protocol_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
@@ -34,9 +35,16 @@
resetting_(false),
database_loaded_(false) {
new_safe_browsing_ = !CommandLine().HasSwitch(switches::kUseOldSafeBrowsing);
+ base::SystemMonitor* monitor = base::SystemMonitor::Get();
+ DCHECK(monitor);
+ if (monitor)
+ monitor->AddObserver(this);
}
SafeBrowsingService::~SafeBrowsingService() {
+ base::SystemMonitor* monitor = base::SystemMonitor::Get();
+ if (monitor)
+ monitor->RemoveObserver(this);
}
// Only called on the UI thread.
@@ -662,18 +670,17 @@
GetDatabase()->CacheHashResults(prefixes, full_hashes);
}
-void SafeBrowsingService::OnSuspend() {
+void SafeBrowsingService::OnSuspend(base::SystemMonitor*) {
}
// Tell the SafeBrowsing database not to do expensive disk operations for a few
// minutes after waking up. It's quite likely that the act of resuming from a
// low power state will involve much disk activity, which we don't want to
// exacerbate.
-void SafeBrowsingService::OnResume() {
- DCHECK(MessageLoop::current() == io_loop_);
+void SafeBrowsingService::OnResume(base::SystemMonitor*) {
if (enabled_) {
- db_thread_->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(this, &SafeBrowsingService::HandleResume));
+ ChromeThread::GetMessageLoop(ChromeThread::DB)->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &SafeBrowsingService::HandleResume));
}
}
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | chrome/browser/suspend_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698