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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database.cc

Issue 449283002: Safebrowsing: grab lookup_lock_ when clearing browse_gethash_cache_ during update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/safe_browsing/safe_browsing_database.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 HandleCorruptDatabase(); 1006 HandleCorruptDatabase();
1007 return false; 1007 return false;
1008 } 1008 }
1009 1009
1010 if (ip_blacklist_store_ && !ip_blacklist_store_->BeginUpdate()) { 1010 if (ip_blacklist_store_ && !ip_blacklist_store_->BeginUpdate()) {
1011 RecordFailure(FAILURE_IP_BLACKLIST_UPDATE_BEGIN); 1011 RecordFailure(FAILURE_IP_BLACKLIST_UPDATE_BEGIN);
1012 HandleCorruptDatabase(); 1012 HandleCorruptDatabase();
1013 return false; 1013 return false;
1014 } 1014 }
1015 1015
1016 // Cached fullhash results must be cleared on every database update (whether 1016 {
1017 // successful or not.) 1017 base::AutoLock locked(lookup_lock_);
1018 browse_gethash_cache_.clear(); 1018 // Cached fullhash results must be cleared on every database update (whether
1019 // successful or not.)
1020 browse_gethash_cache_.clear();
1021 }
1019 1022
1020 UpdateChunkRangesForLists(browse_store_.get(), 1023 UpdateChunkRangesForLists(browse_store_.get(),
1021 safe_browsing_util::kMalwareList, 1024 safe_browsing_util::kMalwareList,
1022 safe_browsing_util::kPhishingList, 1025 safe_browsing_util::kPhishingList,
1023 lists); 1026 lists);
1024 1027
1025 // NOTE(shess): |download_store_| used to contain kBinHashList, which has been 1028 // NOTE(shess): |download_store_| used to contain kBinHashList, which has been
1026 // deprecated. Code to delete the list from the store shows ~15k hits/day as 1029 // deprecated. Code to delete the list from the store shows ~15k hits/day as
1027 // of Feb 2014, so it has been removed. Everything _should_ be resilient to 1030 // of Feb 2014, so it has been removed. Everything _should_ be resilient to
1028 // extra data of that sort. 1031 // extra data of that sort.
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { 1567 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() {
1565 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); 1568 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl);
1566 std::vector<SBFullHash> full_hashes; 1569 std::vector<SBFullHash> full_hashes;
1567 full_hashes.push_back(malware_kill_switch); 1570 full_hashes.push_back(malware_kill_switch);
1568 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); 1571 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes);
1569 } 1572 }
1570 1573
1571 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() { 1574 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() {
1572 return csd_whitelist_.second; 1575 return csd_whitelist_.second;
1573 } 1576 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698