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

Unified Diff: components/safe_browsing_db/v4_store.h

Issue 2151953003: PVer4: Drop hash prefixes based on the removals field in the response (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@02_iterators
Patch Set: nparker@ CR feedback 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 | « no previous file | components/safe_browsing_db/v4_store.cc » ('j') | components/safe_browsing_db/v4_store.cc » ('J')
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 c4bf355f7e5e3f784483b96d636c87d093165daa..59e0537569f00e773dfeccd0d057c40435418b0a 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing_db/v4_store.h
@@ -128,6 +128,10 @@ enum ApplyUpdateResult {
// The server sent a response_type that the client did not expect.
UNEXPECTED_RESPONSE_TYPE_FAILURE = 6,
+ // One of more index(es) in removals field of the response is greater than
+ // the number of hash prefixes currently in the (old) store.
+ REMOVALS_INDEX_TOO_LARGE = 7,
+
// Memory space for histograms is determined by the max. ALWAYS
// ADD NEW VALUES BEFORE THIS ONE.
APPLY_UPDATE_RESULT_MAX
@@ -197,6 +201,16 @@ class V4Store {
FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
TestMergeUpdatesFailsForRepeatedHashPrefix);
FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
+ TestMergeUpdatesFailsWhenRemovalsIndexTooLarge);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesRemovesOnlyElement);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesRemovesFirstElement);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesRemovesMiddleElement);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesRemovesLastElement);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
+ TestMergeUpdatesRemovesWhenOldHasDifferentSizes);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
+ TestMergeUpdatesRemovesMultipleAcrossDifferentSizes);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
TestReadFullResponseWithValidHashPrefixMap);
FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
TestReadFullResponseWithInvalidHashPrefixMap);
@@ -240,7 +254,9 @@ class V4Store {
// update (additions_map) to populate the prefix map for the current store.
// TODO(vakh): Process removals also.
ApplyUpdateResult MergeUpdate(const HashPrefixMap& old_hash_prefix_map,
- const HashPrefixMap& additions_map);
+ const HashPrefixMap& additions_map,
+ const ::google::protobuf::RepeatedField<
+ ::google::protobuf::int32>* raw_removals);
// Reads the state of the store from the file on disk and returns the reason
// for the failure or reports success.
@@ -250,6 +266,8 @@ class V4Store {
StoreWriteResult WriteToDisk(
std::unique_ptr<ListUpdateResponse> response) const;
+ const ::google::protobuf::RepeatedField<::google::protobuf::int32>
Nathan Parker 2016/07/18 19:54:35 Could this be declared in an empty namespace in th
vakh (use Gerrit instead) 2016/07/18 19:58:30 Done.
+ empty_removals_;
// The state of the store as returned by the PVer4 server in the last applied
// update response.
std::string state_;
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_store.cc » ('j') | components/safe_browsing_db/v4_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698