diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 22:17:25 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 22:17:25 +0000 |
commit | ae7ca1b9b87f64b8c798cc9db11cc568e9ae421e (patch) | |
tree | 2028b70d318110ec2e44760859bc9bb16c4d3d09 /chrome/browser/safe_browsing | |
parent | a4bcf7d648a9dcbc75b989801f8126b080d55ba0 (diff) | |
download | chromium_src-ae7ca1b9b87f64b8c798cc9db11cc568e9ae421e.zip chromium_src-ae7ca1b9b87f64b8c798cc9db11cc568e9ae421e.tar.gz chromium_src-ae7ca1b9b87f64b8c798cc9db11cc568e9ae421e.tar.bz2 |
Review URL: http://codereview.chromium.org/10958
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.cc | 17 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.h | 10 |
2 files changed, 8 insertions, 19 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 2474c4e..e38bcc4 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -12,7 +12,6 @@ #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,16 +34,9 @@ SafeBrowsingService::SafeBrowsingService() resetting_(false), database_loaded_(false) { new_safe_browsing_ = CommandLine().HasSwitch(switches::kUseNewSafeBrowsing); - 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. @@ -663,17 +655,18 @@ void SafeBrowsingService::CacheHashResults( GetDatabase()->CacheHashResults(prefixes, full_hashes); } -void SafeBrowsingService::OnSuspend(base::SystemMonitor*) { +void SafeBrowsingService::OnSuspend() { } // 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(base::SystemMonitor*) { +void SafeBrowsingService::OnResume() { + DCHECK(MessageLoop::current() == io_loop_); if (enabled_) { - ChromeThread::GetMessageLoop(ChromeThread::DB)->PostTask(FROM_HERE, - NewRunnableMethod(this, &SafeBrowsingService::HandleResume)); + db_thread_->message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(this, &SafeBrowsingService::HandleResume)); } } diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index c3125e5..761acb2 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -16,7 +16,6 @@ #include "base/hash_tables.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "base/system_monitor.h" #include "base/thread.h" #include "base/time.h" #include "chrome/browser/safe_browsing/safe_browsing_util.h" @@ -32,8 +31,7 @@ class SafeBrowsingProtocolManager; // Construction needs to happen on the main thread. class SafeBrowsingService - : public base::RefCountedThreadSafe<SafeBrowsingService>, - public base::SystemMonitor::PowerObserver { + : public base::RefCountedThreadSafe<SafeBrowsingService> { public: // Users of this service implement this interface to be notified // asynchronously of the result. @@ -171,12 +169,10 @@ class SafeBrowsingService // the current page is 'safe'. void LogPauseDelay(base::TimeDelta time); - // PowerObserver notifications // We defer SafeBrowsing work for a short duration when the computer comes // out of a suspend state to avoid thrashing the disk. - void OnPowerStateChange(base::SystemMonitor*) {}; - void OnSuspend(base::SystemMonitor*); - void OnResume(base::SystemMonitor*); + void OnSuspend(); + void OnResume(); bool new_safe_browsing() const { return new_safe_browsing_; } |