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

Unified Diff: components/safe_browsing_db/v4_store.h

Issue 2145163003: PVer4: Keep track of the smallest hashes not their sizes. Replace counters with iterators. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_read_map_from_disk
Patch Set: 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 b88d0f0f18104372b049c45e621bdac436d44c9a..cd71579110fc6eb406feb4a42034bd943ca3cbca 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing_db/v4_store.h
@@ -32,10 +32,11 @@ typedef std::string HashPrefixes;
// For instance: {4: ["abcd", "bcde", "cdef", "gggg"], 5: ["fffff"]}
typedef base::hash_map<PrefixSize, HashPrefixes> HashPrefixMap;
-// Stores the index of the last element merged from the HashPrefixMap for a
-// given prefix size. For instance: {4:3, 5:1} means that we have already merged
+// Stores the iterator to the last element merged from the HashPrefixMap for a
+// given prefix size.
+// For instance: {4:iter(3), 5:iter(1)} means that we have already merged
// 3 hash prefixes of length 4, and 1 hash prefix of length 5.
-typedef base::hash_map<PrefixSize, size_t> CounterMap;
+typedef base::hash_map<PrefixSize, HashPrefixes::const_iterator> IteratorMap;
// Enumerate different failure events while parsing the file read from disk for
// histogramming purposes. DO NOT CHANGE THE ORDERING OF THESE VALUES.
@@ -209,24 +210,24 @@ class V4Store {
HashPrefixMap* additions_map);
// Get the size of the next unmerged hash prefix in dictionary order from
- // |hash_prefix_map|. |counter_map| is used to determine which hash prefixes
+ // |hash_prefix_map|. |iterator_map| is used to determine which hash prefixes
// have been merged already. Returns true if there are any unmerged hash
// prefixes in the list.
static bool GetNextSmallestPrefixSize(const HashPrefixMap& hash_prefix_map,
- const CounterMap& counter_map,
+ const IteratorMap& iterator_map,
PrefixSize* smallest_prefix_size);
// Returns the next hash prefix of length |prefix_size| from |hash_prefix_map|
- // that hasn't been merged already. |counter_map| is used to determine the
+ // that hasn't been merged already. |iterator_map| is used to determine the
// index of the next prefix of size |prefix_size| to merge.
static HashPrefix GetNextUnmergedPrefixForSize(
PrefixSize prefix_size,
const HashPrefixMap& hash_prefix_map,
- const CounterMap& counter_map);
+ const IteratorMap& iterator_map);
- // Sets a value of 0 in |counter_map| for all keys in |hash_prefix_map|.
- static void InitializeCounterMap(const HashPrefixMap& hash_prefix_map,
- CounterMap* counter_map);
+ // Sets a value of 0 in |iterator_map| for all keys in |hash_prefix_map|.
+ static void InitializeIteratorMap(const HashPrefixMap& hash_prefix_map,
+ IteratorMap* iterator_map);
// Reserve the appropriate string size so that the string size of the merged
// list is exact. This ignores the space that would otherwise be released by
« 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