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

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

Issue 2421703002: Tiny: Post PerformFullHashCheck on IO thread, instead of calling it synchronously. (Closed)
Patch Set: Add comment about why PerformFullHashCheck is being posted 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 // This file should not be build on Android but is currently getting built. 5 // This file should not be build on Android but is currently getting built.
6 // TODO(vakh): Fix that: http://crbug.com/621647 6 // TODO(vakh): Fix that: http://crbug.com/621647
7 7
8 #include "components/safe_browsing_db/v4_local_database_manager.h" 8 #include "components/safe_browsing_db/v4_local_database_manager.h"
9 9
10 #include <vector> 10 #include <vector>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 if (!v4_database_) { 142 if (!v4_database_) {
143 queued_checks_.push_back(std::move(check)); 143 queued_checks_.push_back(std::move(check));
144 return false; 144 return false;
145 } 145 }
146 146
147 FullHashToStoreAndHashPrefixesMap full_hash_to_store_and_hash_prefixes; 147 FullHashToStoreAndHashPrefixesMap full_hash_to_store_and_hash_prefixes;
148 if (!GetPrefixMatches(check, &full_hash_to_store_and_hash_prefixes)) { 148 if (!GetPrefixMatches(check, &full_hash_to_store_and_hash_prefixes)) {
149 return true; 149 return true;
150 } 150 }
151 151
152 PerformFullHashCheck(std::move(check), full_hash_to_store_and_hash_prefixes); 152 // Post the task to check full hashes back on the IO thread to follow the
153 // documented behavior of CheckBrowseUrl.
154 BrowserThread::PostTask(
155 BrowserThread::IO, FROM_HERE,
156 base::Bind(&V4LocalDatabaseManager::PerformFullHashCheck, this,
157 base::Passed(std::move(check)),
158 full_hash_to_store_and_hash_prefixes));
153 return false; 159 return false;
154 } 160 }
155 161
156 bool V4LocalDatabaseManager::CheckDownloadUrl( 162 bool V4LocalDatabaseManager::CheckDownloadUrl(
157 const std::vector<GURL>& url_chain, 163 const std::vector<GURL>& url_chain,
158 Client* client) { 164 Client* client) {
159 DCHECK_CURRENTLY_ON(BrowserThread::IO); 165 DCHECK_CURRENTLY_ON(BrowserThread::IO);
160 // TODO(vakh): Implement this skeleton. 166 // TODO(vakh): Implement this skeleton.
161 return true; 167 return true;
162 } 168 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 494 }
489 495
490 void V4LocalDatabaseManager::UpdateRequestCompleted( 496 void V4LocalDatabaseManager::UpdateRequestCompleted(
491 std::unique_ptr<ParsedServerResponse> parsed_server_response) { 497 std::unique_ptr<ParsedServerResponse> parsed_server_response) {
492 DCHECK_CURRENTLY_ON(BrowserThread::IO); 498 DCHECK_CURRENTLY_ON(BrowserThread::IO);
493 v4_database_->ApplyUpdate(std::move(parsed_server_response), 499 v4_database_->ApplyUpdate(std::move(parsed_server_response),
494 db_updated_callback_); 500 db_updated_callback_);
495 } 501 }
496 502
497 } // namespace safe_browsing 503 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698