diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-13 21:50:34 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-13 21:50:34 +0000 |
commit | 53ad85727d113b3228d8e932effbc01da6ade802 (patch) | |
tree | d83ef6e7ad71bf9f1f66183a1b83a47bae716956 /chrome/browser/safe_browsing/safe_browsing_service.cc | |
parent | 80ba44ab061af8c4177dffc5f57ccf153293e95e (diff) | |
download | chromium_src-53ad85727d113b3228d8e932effbc01da6ade802.zip chromium_src-53ad85727d113b3228d8e932effbc01da6ade802.tar.gz chromium_src-53ad85727d113b3228d8e932effbc01da6ade802.tar.bz2 |
Reduce memory consumption by keeping the SafeBrowsing
database closed when not processing updates.
Review URL: http://codereview.chromium.org/10643
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5381 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/safe_browsing_service.cc')
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 792a4d8..c09806d 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -595,9 +595,13 @@ void SafeBrowsingService::GetAllChunksFromDatabase() { DCHECK(MessageLoop::current() == db_thread_->message_loop()); bool database_error = true; std::vector<SBListChunkRanges> lists; - if (GetDatabase() && GetDatabase()->UpdateStarted()) { - GetDatabase()->GetListsInfo(&lists); - database_error = false; + if (GetDatabase()) { + if (GetDatabase()->UpdateStarted()) { + GetDatabase()->GetListsInfo(&lists); + database_error = false; + } else { + GetDatabase()->UpdateFinished(false); + } } io_loop_->PostTask(FROM_HERE, NewRunnableMethod( @@ -658,7 +662,11 @@ void SafeBrowsingService::OnResume() { void SafeBrowsingService::HandleResume() { DCHECK(MessageLoop::current() == db_thread_->message_loop()); - GetDatabase()->HandleResume(); + // We don't call GetDatabase() here, since we want to avoid unnecessary calls + // to Open, Reset, etc, or reload the bloom filter while we're coming out of + // a suspended state. + if (database_) + database_->HandleResume(); } void SafeBrowsingService::RunQueuedClients() { |