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

Unified Diff: components/safe_browsing_db/v4_store.h

Issue 2190233002: Rice decode removals and additions and use them to update the store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_v4_rice
Patch Set: Tiny: Remove a comment. Club non-static functions together in .h Created 4 years, 4 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_rice.cc ('k') | 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 310004dc5df5e0e93edbb60f9ed03557f49e1107..94621e5281cac0682e505c695513c4090bfb7b22 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing_db/v4_store.h
@@ -133,7 +133,16 @@ enum ApplyUpdateResult {
// 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,
+ REMOVALS_INDEX_TOO_LARGE_FAILURE = 7,
+
+ // Failed to decode the Rice-encoded additions/removals field.
+ RICE_DECODING_FAILURE = 8,
+
+ // Compression type other than RAW and RICE for additions.
+ UNEXPECTED_COMPRESSION_TYPE_ADDITIONS_FAILURE = 9,
+
+ // Compression type other than RAW and RICE for removals.
+ UNEXPECTED_COMPRESSION_TYPE_REMOVALS_FAILURE = 10,
// Memory space for histograms is determined by the max. ALWAYS
// ADD NEW VALUES BEFORE THIS ONE.
@@ -238,6 +247,11 @@ class V4Store {
TestHashPrefixExistsInMapWithDifferentSizes);
FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
TestHashPrefixDoesNotExistInMapWithDifferentSizes);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
+ TestAdditionsWithRiceEncodingFailsWithInvalidInput);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestAdditionsWithRiceEncodingSucceeds);
+ FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestRemovalsWithRiceEncodingSucceeds);
+ friend class V4StoreTest;
// If |prefix_size| is within expected range, and |raw_hashes| is not invalid,
// then it sets |raw_hashes| as the value at key |prefix_size| in
@@ -287,6 +301,20 @@ class V4Store {
const ::google::protobuf::RepeatedField<
::google::protobuf::int32>* raw_removals);
+ // Processes the FULL_UPDATE |response| from the server and updates the
+ // V4Store in |new_store| and writes it to disk. If processing the |response|
+ // succeeds, it returns APPLY_UPDATE_SUCCESS.
+ ApplyUpdateResult ProcessFullUpdate(
+ std::unique_ptr<ListUpdateResponse> response,
+ const std::unique_ptr<V4Store>& new_store);
+
+ // Processes the PARTIAL_UPDATE |response| from the server and updates the
+ // V4Store in |new_store|. If processing the |response| succeeds, it returns
+ // APPLY_UPDATE_SUCCESS.
+ ApplyUpdateResult ProcessPartialUpdate(
+ std::unique_ptr<ListUpdateResponse> response,
+ const std::unique_ptr<V4Store>& new_store);
+
// Reads the state of the store from the file on disk and returns the reason
// for the failure or reports success.
StoreReadResult ReadFromDisk();
« no previous file with comments | « components/safe_browsing_db/v4_rice.cc ('k') | components/safe_browsing_db/v4_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698