| OLD | NEW |
| 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 // Implementation of the ThreatDetails class. | 5 // Implementation of the ThreatDetails class. |
| 6 | 6 |
| 7 #include "chrome/browser/safe_browsing/threat_details.h" | 7 #include "chrome/browser/safe_browsing/threat_details.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 resources_ = resources; | 47 resources_ = resources; |
| 48 resources_it_ = resources_->begin(); | 48 resources_it_ = resources_->begin(); |
| 49 result_ = result; | 49 result_ = result; |
| 50 callback_ = callback; | 50 callback_ = callback; |
| 51 has_started_ = true; | 51 has_started_ = true; |
| 52 | 52 |
| 53 // Post a task in the message loop, so the callers don't need to | 53 // Post a task in the message loop, so the callers don't need to |
| 54 // check if we call their callback immediately. | 54 // check if we call their callback immediately. |
| 55 BrowserThread::PostTask( | 55 BrowserThread::PostTask( |
| 56 BrowserThread::IO, FROM_HERE, | 56 BrowserThread::IO, FROM_HERE, |
| 57 base::Bind(&ThreatDetailsCacheCollector::OpenEntry, this)); | 57 base::BindOnce(&ThreatDetailsCacheCollector::OpenEntry, this)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool ThreatDetailsCacheCollector::HasStarted() { | 60 bool ThreatDetailsCacheCollector::HasStarted() { |
| 61 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 61 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 62 return has_started_; | 62 return has_started_; |
| 63 } | 63 } |
| 64 | 64 |
| 65 ThreatDetailsCacheCollector::~ThreatDetailsCacheCollector() {} | 65 ThreatDetailsCacheCollector::~ThreatDetailsCacheCollector() {} |
| 66 | 66 |
| 67 // Fetch a URL and advance to the next one when done. | 67 // Fetch a URL and advance to the next one when done. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 void ThreatDetailsCacheCollector::AdvanceEntry() { | 221 void ThreatDetailsCacheCollector::AdvanceEntry() { |
| 222 DVLOG(1) << "AdvanceEntry"; | 222 DVLOG(1) << "AdvanceEntry"; |
| 223 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 223 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 224 // Advance to the next resource. | 224 // Advance to the next resource. |
| 225 ++resources_it_; | 225 ++resources_it_; |
| 226 current_fetch_.reset(NULL); | 226 current_fetch_.reset(NULL); |
| 227 | 227 |
| 228 // Create a task so we don't take over the IO thread for too long. | 228 // Create a task so we don't take over the IO thread for too long. |
| 229 BrowserThread::PostTask( | 229 BrowserThread::PostTask( |
| 230 BrowserThread::IO, FROM_HERE, | 230 BrowserThread::IO, FROM_HERE, |
| 231 base::Bind(&ThreatDetailsCacheCollector::OpenEntry, this)); | 231 base::BindOnce(&ThreatDetailsCacheCollector::OpenEntry, this)); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void ThreatDetailsCacheCollector::AllDone(bool success) { | 234 void ThreatDetailsCacheCollector::AllDone(bool success) { |
| 235 DVLOG(1) << "AllDone"; | 235 DVLOG(1) << "AllDone"; |
| 236 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 236 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 237 *result_ = success; | 237 *result_ = success; |
| 238 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 238 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
| 239 callback_.Reset(); | 239 callback_.Reset(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace safe_browsing | 242 } // namespace safe_browsing |
| OLD | NEW |