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

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: Remove DVLOGs. Add tests (not proud of the last test). 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
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..f7e2d126bac4f29e51ddf5ce0b1b5c9d5e6176d8 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.
Nathan Parker 2016/08/02 23:43:31 Nit: This might be a bit more detailed error repor
vakh (use Gerrit instead) 2016/08/03 06:54:53 I think it may be useful in the beginning as we ro
+ 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;
Nathan Parker 2016/08/02 23:43:31 Does this obviate the need for all the friends? I
vakh (use Gerrit instead) 2016/08/03 06:54:52 Unfortunately not. The individual tests are not a
// 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

Powered by Google App Engine
This is Rietveld 408576698