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

Side by Side Diff: components/safe_browsing_db/v4_store.h

Issue 2228393003: PVer4: DecodeHashes needs to sort the output of the Rice decoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_checksum
Patch Set: DecodeBytes->DecodePrefixes. More detailed comment. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 TestHashPrefixExistsInMapWithDifferentSizes); 245 TestHashPrefixExistsInMapWithDifferentSizes);
246 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, 246 FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
247 TestHashPrefixDoesNotExistInMapWithDifferentSizes); 247 TestHashPrefixDoesNotExistInMapWithDifferentSizes);
248 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, 248 FRIEND_TEST_ALL_PREFIXES(V4StoreTest,
249 TestAdditionsWithRiceEncodingFailsWithInvalidInput); 249 TestAdditionsWithRiceEncodingFailsWithInvalidInput);
250 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestAdditionsWithRiceEncodingSucceeds); 250 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestAdditionsWithRiceEncodingSucceeds);
251 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestRemovalsWithRiceEncodingSucceeds); 251 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestRemovalsWithRiceEncodingSucceeds);
252 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesFailsChecksum); 252 FRIEND_TEST_ALL_PREFIXES(V4StoreTest, TestMergeUpdatesFailsChecksum);
253 friend class V4StoreTest; 253 friend class V4StoreTest;
254 254
255 // If |prefix_size| is within expected range, and |raw_hashes| is not invalid, 255 // If |prefix_size| is within expected range, and |raw_hashes_length| is a
256 // then it sets |raw_hashes| as the value at key |prefix_size| in 256 // multiple of prefix_size, then it sets the string of length
257 // |additions_map| 257 // |raw_hashes_length| starting at |raw_hashes_begin| as the value at key
258 // |prefix_size| in |additions_map|
259 static ApplyUpdateResult AddUnlumpedHashes(PrefixSize prefix_size,
260 const char* raw_hashes_begin,
261 const size_t raw_hashes_length,
262 HashPrefixMap* additions_map);
263
264 // An overloaded version of AddUnlumpedHashes that allows passing in a
265 // std::string object.
258 static ApplyUpdateResult AddUnlumpedHashes(PrefixSize prefix_size, 266 static ApplyUpdateResult AddUnlumpedHashes(PrefixSize prefix_size,
259 const std::string& raw_hashes, 267 const std::string& raw_hashes,
260 HashPrefixMap* additions_map); 268 HashPrefixMap* additions_map);
261 269
262 // Get the next unmerged hash prefix in dictionary order from 270 // Get the next unmerged hash prefix in dictionary order from
263 // |hash_prefix_map|. |iterator_map| is used to determine which hash prefixes 271 // |hash_prefix_map|. |iterator_map| is used to determine which hash prefixes
264 // have been merged already. Returns true if there are any unmerged hash 272 // have been merged already. Returns true if there are any unmerged hash
265 // prefixes in the list. 273 // prefixes in the list.
266 static bool GetNextSmallestUnmergedPrefix( 274 static bool GetNextSmallestUnmergedPrefix(
267 const HashPrefixMap& hash_prefix_map, 275 const HashPrefixMap& hash_prefix_map,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 const base::FilePath store_path_; 355 const base::FilePath store_path_;
348 HashPrefixMap hash_prefix_map_; 356 HashPrefixMap hash_prefix_map_;
349 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 357 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
350 }; 358 };
351 359
352 std::ostream& operator<<(std::ostream& os, const V4Store& store); 360 std::ostream& operator<<(std::ostream& os, const V4Store& store);
353 361
354 } // namespace safe_browsing 362 } // namespace safe_browsing
355 363
356 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 364 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
OLDNEW
« no previous file with comments | « components/safe_browsing_db/v4_rice_unittest.cc ('k') | components/safe_browsing_db/v4_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698