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

Side by Side 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: 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 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 #include <memory> 5 #include <memory>
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/debug/leak_annotations.h" 8 #include "base/debug/leak_annotations.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 std::unique_ptr<StoreStateMap> V4Database::GetStoreStateMap() { 162 std::unique_ptr<StoreStateMap> V4Database::GetStoreStateMap() {
163 std::unique_ptr<StoreStateMap> store_state_map = 163 std::unique_ptr<StoreStateMap> store_state_map =
164 base::MakeUnique<StoreStateMap>(); 164 base::MakeUnique<StoreStateMap>();
165 for (const auto& store_map_iter : *store_map_) { 165 for (const auto& store_map_iter : *store_map_) {
166 (*store_state_map)[store_map_iter.first] = store_map_iter.second->state(); 166 (*store_state_map)[store_map_iter.first] = store_map_iter.second->state();
167 } 167 }
168 return store_state_map; 168 return store_state_map;
169 } 169 }
170 170
171 void V4Database::GetStoresMatchingFullHash(const FullHash& full_hash,
Nathan Parker 2016/07/19 23:05:56 What's the usecase for this function? I think the
vakh (use Gerrit instead) 2016/07/20 00:07:43 Done. The goal of this method is to identify the
172 StoresMatched* stores_matched) {
173 DCHECK(stores_matched);
174 for (const auto& store_pair : *store_map_) {
175 const UpdateListIdentifier& identifier = store_pair.first;
176 const std::unique_ptr<V4Store>& store = store_pair.second;
177
178 HashPrefix hash_prefix = store->GetMatchingHashPrefix(full_hash);
179 if (!hash_prefix.empty()) {
180 stores_matched->push_back(identifier);
181 }
182 }
183 }
184
171 } // namespace safe_browsing 185 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698