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

Unified Diff: components/safe_browsing_db/v4_store.h

Issue 2406373003: Small: Delay checksum only on ReadFromDisk, not in FullUpdate cases (Closed)
Patch Set: Remove extra bool argument from MergeUpdate calls in tests Created 4 years, 2 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 | « no previous file | components/safe_browsing_db/v4_store.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.h
diff --git a/components/safe_browsing_db/v4_store.h b/components/safe_browsing_db/v4_store.h
index befa6f9b0c178a0eabfb16853c0874448d4a580d..1b9e4d6ba00b691233d247d30a3b6110bee3e265 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing_db/v4_store.h
@@ -256,6 +256,7 @@ class V4Store {
FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesFailsChecksum);
FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestChecksumErrorOnStartup);
FRIEND_TEST_ALL_PREFIXES(V4StoreTest, WriteToDiskFails);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest, FullUpdateFailsChecksumSynchronously);
friend class V4StoreTest;
// If |prefix_size| is within expected range, and |raw_hashes_length| is a
@@ -306,11 +307,12 @@ class V4Store {
// The SHA256 checksum of the final list of hash prefixes, in
// lexicographically sorted order, must match |expected_checksum| (if it's not
// empty).
- ApplyUpdateResult MergeUpdate(const HashPrefixMap& old_hash_prefix_map,
- const HashPrefixMap& additions_map,
- const ::google::protobuf::RepeatedField<
- ::google::protobuf::int32>* raw_removals,
- const std::string& expected_checksum);
+ ApplyUpdateResult MergeUpdate(
+ const HashPrefixMap& old_hash_prefix_map,
+ const HashPrefixMap& additions_map,
+ const ::google::protobuf::RepeatedField<::google::protobuf::int32>*
+ raw_removals,
+ const std::string& expected_checksum);
// Processes the FULL_UPDATE |response| from the server, and writes the
// merged V4Store to disk. If processing the |response| succeeds, it returns
@@ -325,10 +327,12 @@ class V4Store {
// the |response| succeeds, it returns APPLY_UPDATE_SUCCESS.
// This method is called when we receive a FULL_UPDATE from the server, and
// when we read a store file from disk on startup. The UMA metrics for all
- // interesting sub-operations use the prefix |metric|.
+ // interesting sub-operations use the prefix |metric|. Delays the checksum
+ // check if |delay_checksum_check| is true.
ApplyUpdateResult ProcessFullUpdate(
const std::string& metric,
- const std::unique_ptr<ListUpdateResponse>& response);
+ const std::unique_ptr<ListUpdateResponse>& response,
+ bool delay_checksum_check);
// Merges the hash prefixes in |hash_prefix_map_old| and |response|, updates
// the |hash_prefix_map_| and |state_| in the V4Store, and writes the merged
@@ -344,11 +348,13 @@ class V4Store {
// Merges the hash prefixes in |hash_prefix_map_old| and |response|, and
// updates the |hash_prefix_map_| and |state_| in the V4Store. If processing
// succeeds, it returns APPLY_UPDATE_SUCCESS. The UMA metrics for all
- // interesting sub-operations use the prefix |metric|.
+ // interesting sub-operations use the prefix |metric|. Delays the checksum
+ // check if |delay_checksum_check| is true.
ApplyUpdateResult ProcessUpdate(
const std::string& metric,
const HashPrefixMap& hash_prefix_map_old,
- const std::unique_ptr<ListUpdateResponse>& response);
+ const std::unique_ptr<ListUpdateResponse>& response,
+ bool delay_checksum_check);
// Reads the state of the store from the file on disk and returns the reason
// for the failure or reports success.
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698