| 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 #include "content/browser/download/download_file_impl.h" | 5 #include "content/browser/download/download_file_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 const int kUpdatePeriodMs = 500; | 27 const int kUpdatePeriodMs = 500; |
| 28 const int kMaxTimeBlockingFileThreadMs = 1000; | 28 const int kMaxTimeBlockingFileThreadMs = 1000; |
| 29 | 29 |
| 30 DownloadFileImpl::DownloadFileImpl( | 30 DownloadFileImpl::DownloadFileImpl( |
| 31 const DownloadCreateInfo* info, | 31 const DownloadCreateInfo* info, |
| 32 scoped_ptr<content::ByteStreamReader> stream, | 32 scoped_ptr<content::ByteStreamReader> stream, |
| 33 DownloadRequestHandleInterface* request_handle, | 33 DownloadRequestHandleInterface* request_handle, |
| 34 DownloadManager* download_manager, | 34 DownloadManager* download_manager, |
| 35 bool calculate_hash, | 35 bool calculate_hash, |
| 36 scoped_ptr<PowerSaveBlocker> power_save_blocker, | 36 scoped_ptr<content::PowerSaveBlocker> power_save_blocker, |
| 37 const net::BoundNetLog& bound_net_log) | 37 const net::BoundNetLog& bound_net_log) |
| 38 : file_(info->save_info.file_path, | 38 : file_(info->save_info.file_path, |
| 39 info->url(), | 39 info->url(), |
| 40 info->referrer_url, | 40 info->referrer_url, |
| 41 info->received_bytes, | 41 info->received_bytes, |
| 42 calculate_hash, | 42 calculate_hash, |
| 43 info->save_info.hash_state, | 43 info->save_info.hash_state, |
| 44 info->save_info.file_stream, | 44 info->save_info.file_stream, |
| 45 bound_net_log), | 45 bound_net_log), |
| 46 stream_reader_(stream.Pass()), | 46 stream_reader_(stream.Pass()), |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 void DownloadFileImpl::SendUpdate() { | 265 void DownloadFileImpl::SendUpdate() { |
| 266 if (download_manager_.get()) { | 266 if (download_manager_.get()) { |
| 267 BrowserThread::PostTask( | 267 BrowserThread::PostTask( |
| 268 BrowserThread::UI, FROM_HERE, | 268 BrowserThread::UI, FROM_HERE, |
| 269 base::Bind(&DownloadManager::UpdateDownload, | 269 base::Bind(&DownloadManager::UpdateDownload, |
| 270 download_manager_, id_.local(), | 270 download_manager_, id_.local(), |
| 271 BytesSoFar(), CurrentSpeed(), GetHashState())); | 271 BytesSoFar(), CurrentSpeed(), GetHashState())); |
| 272 } | 272 } |
| 273 } | 273 } |
| OLD | NEW |