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

Unified Diff: components/safe_browsing_db/v4_database.h

Issue 2160193003: PVer4: V4Database: Return stores that have a hash prefix for a given full hash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@01_check_url_store
Patch Set: incorporate nparker@ 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_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/v4_database.h
diff --git a/components/safe_browsing_db/v4_database.h b/components/safe_browsing_db/v4_database.h
index df458a24809361098e9c019bec5a62e4958efe9a..a5764a128b28afa64ceddeda89e20b701655d2f9 100644
--- a/components/safe_browsing_db/v4_database.h
+++ b/components/safe_browsing_db/v4_database.h
@@ -30,6 +30,10 @@ typedef base::Callback<void()> DatabaseUpdatedCallback;
// as manage their storage on disk.
typedef base::hash_map<UpdateListIdentifier, std::unique_ptr<V4Store>> StoreMap;
+// Map of identifier for any store that had a hash prefix matching the given
+// full hash to the matching hash prefix.
+typedef base::hash_map<UpdateListIdentifier, HashPrefix> MatchedHashPrefixMap;
+
// Factory for creating V4Database. Tests implement this factory to create fake
// databases for testing.
class V4DatabaseFactory {
@@ -74,6 +78,14 @@ class V4Database {
// Returns the current state of each of the stores being managed.
std::unique_ptr<StoreStateMap> GetStoreStateMap();
+ // Searches for a hash prefix matching the |full_hash| in stores in the
+ // database, filtered by |stores_to_look|, and returns the identifier of the
+ // store along with the matching hash prefix in |matched_hash_prefix_map|.
+ void GetStoresMatchingFullHash(
+ const FullHash& full_hash,
+ const base::hash_set<UpdateListIdentifier>& stores_to_look,
+ MatchedHashPrefixMap* matched_hash_prefix_map);
+
// Deletes the current database and creates a new one.
virtual bool ResetDatabase();
@@ -90,6 +102,7 @@ class V4Database {
FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithNoNewState);
FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithEmptyUpdate);
FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestApplyUpdateWithInvalidUpdate);
+ FRIEND_TEST_ALL_PREFIXES(V4DatabaseTest, TestSomeStoresMatchFullHash);
// Makes the passed |factory| the factory used to instantiate a V4Store. Only
// for tests.
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698