summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing/safe_browsing_service.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/safe_browsing/safe_browsing_service.cc')
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index d60f409..fc45b94 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -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"
@@ -35,9 +36,16 @@ SafeBrowsingService::SafeBrowsingService()
database_loaded_(false),
update_in_progress_(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.
@@ -668,18 +676,17 @@ void SafeBrowsingService::CacheHashResults(
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));
}
}