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

Unified Diff: components/safe_browsing_db/v4_database.cc

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: Nit: Updated a comment 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_database.cc
diff --git a/components/safe_browsing_db/v4_database.cc b/components/safe_browsing_db/v4_database.cc
index 3c1cf1c51a64a8a85df58616ccd8e5c6a0e781db..9d0312438d4b00ef6f34748651141a4a4b125277 100644
--- a/components/safe_browsing_db/v4_database.cc
+++ b/components/safe_browsing_db/v4_database.cc
@@ -168,4 +168,21 @@ std::unique_ptr<StoreStateMap> V4Database::GetStoreStateMap() {
return store_state_map;
}
+void V4Database::GetStoresMatchingFullHash(
+ const FullHash& full_hash,
+ const base::hash_set<UpdateListIdentifier>& stores_to_look,
+ MatchedHashPrefixMap* matched_hash_prefix_map) {
+ for (const auto& store_pair : *store_map_) {
Nathan Parker 2016/07/20 20:44:13 This is sort of NxM complexity with two loops (for
vakh (use Gerrit instead) 2016/07/20 21:10:27 Done.
+ const UpdateListIdentifier& identifier = store_pair.first;
+ if (stores_to_look.count(identifier) == 1) {
+ const std::unique_ptr<V4Store>& store = store_pair.second;
+
+ HashPrefix hash_prefix = store->GetMatchingHashPrefix(full_hash);
+ if (!hash_prefix.empty()) {
+ (*matched_hash_prefix_map)[identifier] = hash_prefix;
+ }
+ }
+ }
+}
+
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698