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

Unified Diff: components/safe_browsing_db/v4_store.cc

Issue 2148673002: Parse the hash prefix map from the V4Store on disk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_merge_only
Patch Set: Tiniest: typo: h->H Created 4 years, 5 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 | « components/safe_browsing_db/v4_store.h ('k') | components/safe_browsing_db/v4_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/v4_store.cc
diff --git a/components/safe_browsing_db/v4_store.cc b/components/safe_browsing_db/v4_store.cc
index 7f375d69a3df15203567ee1213406cd922776105..120a23a387e6c5efa02d498e760b99df7fc901a0 100644
--- a/components/safe_browsing_db/v4_store.cc
+++ b/components/safe_browsing_db/v4_store.cc
@@ -40,6 +40,12 @@ void RecordApplyUpdateResult(ApplyUpdateResult result) {
APPLY_UPDATE_RESULT_MAX);
}
+void RecordApplyUpdateResultWhenReadingFromDisk(ApplyUpdateResult result) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "SafeBrowsing.V4ApplyUpdateResultWhenReadingFromDisk", result,
+ APPLY_UPDATE_RESULT_MAX);
+}
+
// Returns the name of the temporary file used to buffer data for
// |filename|. Exported for unit tests.
const base::FilePath TemporaryFileForFilename(const base::FilePath& filename) {
@@ -359,10 +365,16 @@ StoreReadResult V4Store::ReadFromDisk() {
return HASH_PREFIX_INFO_MISSING_FAILURE;
}
- ListUpdateResponse list_update_response = file_format.list_update_response();
- state_ = list_update_response.new_client_state();
- // TODO(vakh): Do more with what's read from the disk.
+ const ListUpdateResponse& response = file_format.list_update_response();
+ ApplyUpdateResult apply_update_result = UpdateHashPrefixMapFromAdditions(
+ response.additions(), &hash_prefix_map_);
+ RecordApplyUpdateResultWhenReadingFromDisk(apply_update_result);
+ if (apply_update_result != APPLY_UPDATE_SUCCESS) {
+ hash_prefix_map_.clear();
+ return HASH_PREFIX_MAP_GENERATION_FAILURE;
+ }
+ state_ = response.new_client_state();
return READ_SUCCESS;
}
« no previous file with comments | « components/safe_browsing_db/v4_store.h ('k') | components/safe_browsing_db/v4_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698