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

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

Issue 2683813002: Part 3: Browser tests for calling client methods Check*Url with PVer4 (Closed)
Patch Set: Added comments for clarity Created 3 years, 10 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 (*store_state_map)[store_map_iter.first] = store_map_iter.second->state(); 210 (*store_state_map)[store_map_iter.first] = store_map_iter.second->state();
211 } 211 }
212 return store_state_map; 212 return store_state_map;
213 } 213 }
214 214
215 bool V4Database::AreStoresAvailable( 215 bool V4Database::AreStoresAvailable(
216 const StoresToCheck& stores_to_check) const { 216 const StoresToCheck& stores_to_check) const {
217 DCHECK_CURRENTLY_ON(BrowserThread::IO); 217 DCHECK_CURRENTLY_ON(BrowserThread::IO);
218 for (const ListIdentifier& identifier : stores_to_check) { 218 for (const ListIdentifier& identifier : stores_to_check) {
219 const auto& store_pair = store_map_->find(identifier); 219 const auto& store_pair = store_map_->find(identifier);
220 if (store_pair == store_map_->end()) 220 if (store_pair == store_map_->end()) {
221 return false; // Store not in our list 221 return false; // Store not in our list
222 if (!store_pair->second->HasValidData()) 222 }
223 if (!store_pair->second->HasValidData()) {
223 return false; // Store never properly populated. 224 return false; // Store never properly populated.
225 }
224 } 226 }
225 return true; 227 return true;
226 } 228 }
227 229
228 void V4Database::GetStoresMatchingFullHash( 230 void V4Database::GetStoresMatchingFullHash(
229 const FullHash& full_hash, 231 const FullHash& full_hash,
230 const StoresToCheck& stores_to_check, 232 const StoresToCheck& stores_to_check,
231 StoreAndHashPrefixes* matched_store_and_hash_prefixes) { 233 StoreAndHashPrefixes* matched_store_and_hash_prefixes) {
232 DCHECK_CURRENTLY_ON(BrowserThread::IO); 234 DCHECK_CURRENTLY_ON(BrowserThread::IO);
233 matched_store_and_hash_prefixes->clear(); 235 matched_store_and_hash_prefixes->clear();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 filename_(filename), 298 filename_(filename),
297 list_id_(list_id), 299 list_id_(list_id),
298 sb_threat_type_(sb_threat_type) { 300 sb_threat_type_(sb_threat_type) {
299 DCHECK(!fetch_updates_ || !filename_.empty()); 301 DCHECK(!fetch_updates_ || !filename_.empty());
300 DCHECK_NE(SB_THREAT_TYPE_SAFE, sb_threat_type_); 302 DCHECK_NE(SB_THREAT_TYPE_SAFE, sb_threat_type_);
301 } 303 }
302 304
303 ListInfo::~ListInfo() {} 305 ListInfo::~ListInfo() {}
304 306
305 } // namespace safe_browsing 307 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698