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

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

Issue 280013002: [safe browsing] Switch to independent cache lifetimes for gethash items. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const that lifetime Created 6 years, 7 months 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/database_manager.h ('k') | chrome/browser/safe_browsing/protocol_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/database_manager.cc
diff --git a/chrome/browser/safe_browsing/database_manager.cc b/chrome/browser/safe_browsing/database_manager.cc
index 7fe23c256bed78e9f18d5d287be9327a950dd463..4e1592f90eebdc8069fac277070aa158eec70e3e 100644
--- a/chrome/browser/safe_browsing/database_manager.cc
+++ b/chrome/browser/safe_browsing/database_manager.cc
@@ -362,8 +362,7 @@ bool SafeBrowsingDatabaseManager::CheckBrowseUrl(const GURL& url,
std::vector<SBFullHashResult> cached_hits;
bool prefix_match =
- database_->ContainsBrowseUrl(url, &prefix_hits, &cached_hits,
- sb_service_->protocol_manager()->last_update());
+ database_->ContainsBrowseUrl(url, &prefix_hits, &cached_hits);
UMA_HISTOGRAM_TIMES("SB2.FilterCheck", base::TimeTicks::Now() - start);
@@ -415,7 +414,7 @@ void SafeBrowsingDatabaseManager::CancelCheck(Client* client) {
void SafeBrowsingDatabaseManager::HandleGetHashResults(
SafeBrowsingCheck* check,
const std::vector<SBFullHashResult>& full_hashes,
- bool can_cache) {
+ const base::TimeDelta& cache_lifetime) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (!enabled_)
@@ -433,10 +432,9 @@ void SafeBrowsingDatabaseManager::HandleGetHashResults(
std::vector<SBPrefix> prefixes = check->prefix_hits;
OnHandleGetHashResults(check, full_hashes); // 'check' is deleted here.
- if (can_cache && MakeDatabaseAvailable()) {
- // Cache the GetHash results in memory:
- database_->CacheHashResults(prefixes, full_hashes);
- }
+ // Cache the GetHash results.
+ if (cache_lifetime != base::TimeDelta() && MakeDatabaseAvailable())
+ database_->CacheHashResults(prefixes, full_hashes, cache_lifetime);
}
void SafeBrowsingDatabaseManager::GetChunks(GetChunksCallback callback) {
@@ -842,14 +840,6 @@ void SafeBrowsingDatabaseManager::OnResetDatabase() {
GetDatabase()->ResetDatabase();
}
-void SafeBrowsingDatabaseManager::CacheHashResults(
- const std::vector<SBPrefix>& prefixes,
- const std::vector<SBFullHashResult>& full_hashes) {
- DCHECK_EQ(base::MessageLoop::current(),
- safe_browsing_thread_->message_loop());
- GetDatabase()->CacheHashResults(prefixes, full_hashes);
-}
-
void SafeBrowsingDatabaseManager::OnHandleGetHashResults(
SafeBrowsingCheck* check,
const std::vector<SBFullHashResult>& full_hashes) {
« no previous file with comments | « chrome/browser/safe_browsing/database_manager.h ('k') | chrome/browser/safe_browsing/protocol_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698