| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/download_resource_handler.h" | 5 #include "chrome/browser/renderer_host/download_resource_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/metrics/stats_counters.h" | 11 #include "base/metrics/stats_counters.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // We schedule a pause outside of the read loop if there is too much file | 203 // We schedule a pause outside of the read loop if there is too much file |
| 204 // writing work to do. | 204 // writing work to do. |
| 205 if (buffer_->contents.size() > kLoadsToWrite) | 205 if (buffer_->contents.size() > kLoadsToWrite) |
| 206 StartPauseTimer(); | 206 StartPauseTimer(); |
| 207 | 207 |
| 208 return true; | 208 return true; |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool DownloadResourceHandler::OnResponseCompleted( | 211 bool DownloadResourceHandler::OnResponseCompleted( |
| 212 int request_id, | 212 int request_id, |
| 213 const URLRequestStatus& status, | 213 const net::URLRequestStatus& status, |
| 214 const std::string& security_info) { | 214 const std::string& security_info) { |
| 215 VLOG(20) << __FUNCTION__ << "()" << DebugString() | 215 VLOG(20) << __FUNCTION__ << "()" << DebugString() |
| 216 << " request_id = " << request_id | 216 << " request_id = " << request_id |
| 217 << " status.status() = " << status.status() | 217 << " status.status() = " << status.status() |
| 218 << " status.os_error() = " << status.os_error(); | 218 << " status.os_error() = " << status.os_error(); |
| 219 BrowserThread::PostTask( | 219 BrowserThread::PostTask( |
| 220 BrowserThread::FILE, FROM_HERE, | 220 BrowserThread::FILE, FROM_HERE, |
| 221 NewRunnableMethod(download_file_manager_, | 221 NewRunnableMethod(download_file_manager_, |
| 222 &DownloadFileManager::OnResponseCompleted, | 222 &DownloadFileManager::OnResponseCompleted, |
| 223 download_id_, | 223 download_id_, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 render_view_id_, | 307 render_view_id_, |
| 308 save_info_.file_path.value().c_str()); | 308 save_info_.file_path.value().c_str()); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void DownloadResourceHandler::UpdateDownloadUrlCheckStats( | 311 void DownloadResourceHandler::UpdateDownloadUrlCheckStats( |
| 312 SBStatsType stat_type) { | 312 SBStatsType stat_type) { |
| 313 UMA_HISTOGRAM_ENUMERATION("SB2.DownloadUrlChecks", | 313 UMA_HISTOGRAM_ENUMERATION("SB2.DownloadUrlChecks", |
| 314 stat_type, | 314 stat_type, |
| 315 DOWNLOAD_URL_CHECKS_MAX); | 315 DOWNLOAD_URL_CHECKS_MAX); |
| 316 } | 316 } |
| OLD | NEW |