| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 base::TimeTicks write_start(base::TimeTicks::Now()); | 225 base::TimeTicks write_start(base::TimeTicks::Now()); |
| 226 reason = AppendDataToFile( | 226 reason = AppendDataToFile( |
| 227 incoming_data.get()->data(), incoming_data_size); | 227 incoming_data.get()->data(), incoming_data_size); |
| 228 disk_writes_time_ += (base::TimeTicks::Now() - write_start); | 228 disk_writes_time_ += (base::TimeTicks::Now() - write_start); |
| 229 bytes_seen_ += incoming_data_size; | 229 bytes_seen_ += incoming_data_size; |
| 230 total_incoming_data_size += incoming_data_size; | 230 total_incoming_data_size += incoming_data_size; |
| 231 } | 231 } |
| 232 break; | 232 break; |
| 233 case ByteStreamReader::STREAM_COMPLETE: | 233 case ByteStreamReader::STREAM_COMPLETE: |
| 234 { | 234 { |
| 235 reason = stream_reader_->GetStatus(); | 235 reason = static_cast<DownloadInterruptReason>( |
| 236 stream_reader_->GetStatus()); |
| 236 SendUpdate(); | 237 SendUpdate(); |
| 237 base::TimeTicks close_start(base::TimeTicks::Now()); | 238 base::TimeTicks close_start(base::TimeTicks::Now()); |
| 238 file_.Finish(); | 239 file_.Finish(); |
| 239 base::TimeTicks now(base::TimeTicks::Now()); | 240 base::TimeTicks now(base::TimeTicks::Now()); |
| 240 disk_writes_time_ += (now - close_start); | 241 disk_writes_time_ += (now - close_start); |
| 241 RecordFileBandwidth( | 242 RecordFileBandwidth( |
| 242 bytes_seen_, disk_writes_time_, now - download_start_); | 243 bytes_seen_, disk_writes_time_, now - download_start_); |
| 243 update_timer_.reset(); | 244 update_timer_.reset(); |
| 244 } | 245 } |
| 245 break; | 246 break; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 observer_, file_.bytes_so_far(), CurrentSpeed(), | 308 observer_, file_.bytes_so_far(), CurrentSpeed(), |
| 308 GetHashState())); | 309 GetHashState())); |
| 309 } | 310 } |
| 310 | 311 |
| 311 // static | 312 // static |
| 312 int DownloadFile::GetNumberOfDownloadFiles() { | 313 int DownloadFile::GetNumberOfDownloadFiles() { |
| 313 return number_active_objects_; | 314 return number_active_objects_; |
| 314 } | 315 } |
| 315 | 316 |
| 316 } // namespace content | 317 } // namespace content |
| OLD | NEW |