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

Side by Side Diff: components/safe_browsing_db/v4_database.cc

Issue 2349603003: V4LDBM: Get response from GetHashManager, detect severest result (Closed)
Patch Set: git pull Created 4 years, 2 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 for (const auto& store_map_iter : *store_map_) { 164 for (const auto& store_map_iter : *store_map_) {
165 (*store_state_map)[store_map_iter.first] = store_map_iter.second->state(); 165 (*store_state_map)[store_map_iter.first] = store_map_iter.second->state();
166 } 166 }
167 return store_state_map; 167 return store_state_map;
168 } 168 }
169 169
170 void V4Database::GetStoresMatchingFullHash( 170 void V4Database::GetStoresMatchingFullHash(
171 const FullHash& full_hash, 171 const FullHash& full_hash,
172 const std::unordered_set<UpdateListIdentifier>& stores_to_look, 172 const std::unordered_set<UpdateListIdentifier>& stores_to_look,
173 StoreAndHashPrefixes* matched_store_and_hash_prefixes) { 173 StoreAndHashPrefixes* matched_store_and_hash_prefixes) {
174 DCHECK_CURRENTLY_ON(BrowserThread::IO);
174 matched_store_and_hash_prefixes->clear(); 175 matched_store_and_hash_prefixes->clear();
175 for (const UpdateListIdentifier& identifier : stores_to_look) { 176 for (const UpdateListIdentifier& identifier : stores_to_look) {
176 const auto& store_pair = store_map_->find(identifier); 177 const auto& store_pair = store_map_->find(identifier);
177 DCHECK(store_pair != store_map_->end()); 178 DCHECK(store_pair != store_map_->end());
178 const std::unique_ptr<V4Store>& store = store_pair->second; 179 const std::unique_ptr<V4Store>& store = store_pair->second;
179 HashPrefix hash_prefix = store->GetMatchingHashPrefix(full_hash); 180 HashPrefix hash_prefix = store->GetMatchingHashPrefix(full_hash);
180 if (!hash_prefix.empty()) { 181 if (!hash_prefix.empty()) {
181 matched_store_and_hash_prefixes->emplace_back(identifier, hash_prefix); 182 matched_store_and_hash_prefixes->emplace_back(identifier, hash_prefix);
182 } 183 }
183 } 184 }
184 } 185 }
185 186
186 StoreIdAndFileName::StoreIdAndFileName(const UpdateListIdentifier& list_id, 187 StoreIdAndFileName::StoreIdAndFileName(const UpdateListIdentifier& list_id,
187 const std::string& filename) 188 const std::string& filename)
188 : list_id(list_id), filename(filename) { 189 : list_id(list_id), filename(filename) {
189 DCHECK(!filename.empty()); 190 DCHECK(!filename.empty());
190 } 191 }
191 192
192 StoreIdAndFileName::~StoreIdAndFileName() {} 193 StoreIdAndFileName::~StoreIdAndFileName() {}
193 194
194 } // namespace safe_browsing 195 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698