Chromium Code Reviews| 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..e6195767d0161575bb9f81d616a3f581bc318b3c 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, |
|
Nathan Parker
2016/07/14 22:36:12
Is this really an update? It's more just a load.
vakh (use Gerrit instead)
2016/07/15 00:07:30
Yes, it depends on the naming strategy in the read
|
| + 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,17 @@ 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(); |
| + HashPrefixMap read_from_disk_map; |
| + ApplyUpdateResult apply_update_result = UpdateHashPrefixMapFromAdditions( |
|
Nathan Parker
2016/07/14 22:36:12
While I think this will work, it does a lot of ext
vakh (use Gerrit instead)
2016/07/14 23:51:57
Umm, that doesn't happen. I may have misunderstood
Nathan Parker
2016/07/15 00:35:31
Blarg. Indeed, that's exactly how I was reading it
|
| + response.additions(), &read_from_disk_map); |
| + RecordApplyUpdateResultWhenReadingFromDisk(apply_update_result); |
| + if (apply_update_result != APPLY_UPDATE_SUCCESS) { |
| + return HASH_PREFIX_MAP_GENERATION_FAILURE; |
| + } |
| + hash_prefix_map_ = read_from_disk_map; |
|
Nathan Parker
2016/07/14 22:36:12
This does a copy of the map.
vakh (use Gerrit instead)
2016/07/14 23:51:57
Done.
|
| + state_ = response.new_client_state(); |
| return READ_SUCCESS; |
| } |