Index: components/safe_browsing_db/v4_database.cc |
diff --git a/components/safe_browsing_db/v4_database.cc b/components/safe_browsing_db/v4_database.cc |
index c1c7b3eedcde90a0736dd7ed77c61e67c7ea76ed..74fbb2c3fd008a30a205c24c7b7f6c65ffef6196 100644 |
--- a/components/safe_browsing_db/v4_database.cc |
+++ b/components/safe_browsing_db/v4_database.cc |
@@ -208,15 +208,10 @@ bool V4Database::AreStoresAvailable( |
const StoresToCheck& stores_to_check) const { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
for (const ListIdentifier& identifier : stores_to_check) { |
- const auto& store_pair = store_map_->find(identifier); |
- if (store_pair == store_map_->end()) { |
- return false; // Store not in our list |
- } |
- if (!store_pair->second->HasValidData()) { |
- return false; // Store never properly populated. |
- } |
+ if (IsStoreAvailable(identifier)) |
+ return true; |
} |
- return true; |
+ return false; |
} |
void V4Database::GetStoresMatchingFullHash( |
@@ -226,6 +221,8 @@ void V4Database::GetStoresMatchingFullHash( |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
matched_store_and_hash_prefixes->clear(); |
for (const ListIdentifier& identifier : stores_to_check) { |
+ if (!IsStoreAvailable(identifier)) |
+ continue; |
const auto& store_pair = store_map_->find(identifier); |
DCHECK(store_pair != store_map_->end()); |
const std::unique_ptr<V4Store>& store = store_pair->second; |
@@ -271,6 +268,19 @@ void V4Database::VerifyChecksumOnTaskRunner( |
FROM_HERE, base::Bind(db_ready_for_updates_callback, stores_to_reset)); |
} |
+bool V4Database::IsStoreAvailable(const ListIdentifier& identifier) const { |
+ const auto& store_pair = store_map_->find(identifier); |
+ if (store_pair == store_map_->end()) { |
+ // Store not in our list |
+ return false; |
+ } |
+ if (!store_pair->second->HasValidData()) { |
+ // Store never properly populated |
+ return false; |
+ } |
+ return true; |
+} |
+ |
void V4Database::RecordFileSizeHistograms() { |
int64_t db_size = 0; |
for (const auto& store_map_iter : *store_map_) { |