OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/download_feedback_service.h" | 5 #include "chrome/browser/safe_browsing/download_feedback_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 DCHECK(!active_feedback_.empty()); | 180 DCHECK(!active_feedback_.empty()); |
181 active_feedback_.front()->Start(base::Bind( | 181 active_feedback_.front()->Start(base::Bind( |
182 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this))); | 182 &DownloadFeedbackService::FeedbackComplete, base::Unretained(this))); |
183 } | 183 } |
184 | 184 |
185 void DownloadFeedbackService::BeginFeedback( | 185 void DownloadFeedbackService::BeginFeedback( |
186 const std::string& ping_request, | 186 const std::string& ping_request, |
187 const std::string& ping_response, | 187 const std::string& ping_response, |
188 const base::FilePath& path) { | 188 const base::FilePath& path) { |
189 DCHECK(CalledOnValidThread()); | 189 DCHECK(CalledOnValidThread()); |
190 scoped_ptr<DownloadFeedback> feedback( | 190 std::unique_ptr<DownloadFeedback> feedback(DownloadFeedback::Create( |
191 DownloadFeedback::Create(request_context_getter_.get(), | 191 request_context_getter_.get(), file_task_runner_.get(), path, |
192 file_task_runner_.get(), | 192 ping_request, ping_response)); |
193 path, | |
194 ping_request, | |
195 ping_response)); | |
196 active_feedback_.push_back(std::move(feedback)); | 193 active_feedback_.push_back(std::move(feedback)); |
197 UMA_HISTOGRAM_COUNTS_100("SBDownloadFeedback.ActiveFeedbacks", | 194 UMA_HISTOGRAM_COUNTS_100("SBDownloadFeedback.ActiveFeedbacks", |
198 active_feedback_.size()); | 195 active_feedback_.size()); |
199 | 196 |
200 if (active_feedback_.size() == 1) | 197 if (active_feedback_.size() == 1) |
201 StartPendingFeedback(); | 198 StartPendingFeedback(); |
202 } | 199 } |
203 | 200 |
204 void DownloadFeedbackService::FeedbackComplete() { | 201 void DownloadFeedbackService::FeedbackComplete() { |
205 DVLOG(1) << __FUNCTION__; | 202 DVLOG(1) << __FUNCTION__; |
206 DCHECK(CalledOnValidThread()); | 203 DCHECK(CalledOnValidThread()); |
207 DCHECK(!active_feedback_.empty()); | 204 DCHECK(!active_feedback_.empty()); |
208 active_feedback_.erase(active_feedback_.begin()); | 205 active_feedback_.erase(active_feedback_.begin()); |
209 if (!active_feedback_.empty()) | 206 if (!active_feedback_.empty()) |
210 StartPendingFeedback(); | 207 StartPendingFeedback(); |
211 } | 208 } |
212 | 209 |
213 } // namespace safe_browsing | 210 } // namespace safe_browsing |
OLD | NEW |