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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 bytes_seen_ += incoming_data_size; | 273 bytes_seen_ += incoming_data_size; |
274 total_incoming_data_size += incoming_data_size; | 274 total_incoming_data_size += incoming_data_size; |
275 } | 275 } |
276 break; | 276 break; |
277 case ByteStreamReader::STREAM_COMPLETE: | 277 case ByteStreamReader::STREAM_COMPLETE: |
278 { | 278 { |
279 reason = static_cast<DownloadInterruptReason>( | 279 reason = static_cast<DownloadInterruptReason>( |
280 stream_reader_->GetStatus()); | 280 stream_reader_->GetStatus()); |
281 SendUpdate(); | 281 SendUpdate(); |
282 base::TimeTicks close_start(base::TimeTicks::Now()); | 282 base::TimeTicks close_start(base::TimeTicks::Now()); |
283 file_.Finish(); | 283 if (reason == DOWNLOAD_INTERRUPT_REASON_NONE) |
| 284 file_.Finish(); |
| 285 else |
| 286 file_.FinishWithError(); |
284 base::TimeTicks now(base::TimeTicks::Now()); | 287 base::TimeTicks now(base::TimeTicks::Now()); |
285 disk_writes_time_ += (now - close_start); | 288 disk_writes_time_ += (now - close_start); |
286 RecordFileBandwidth( | 289 RecordFileBandwidth( |
287 bytes_seen_, disk_writes_time_, now - download_start_); | 290 bytes_seen_, disk_writes_time_, now - download_start_); |
288 update_timer_.reset(); | 291 update_timer_.reset(); |
289 } | 292 } |
290 break; | 293 break; |
291 default: | 294 default: |
292 NOTREACHED(); | 295 NOTREACHED(); |
293 break; | 296 break; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 observer_, file_.bytes_so_far(), CurrentSpeed(), | 355 observer_, file_.bytes_so_far(), CurrentSpeed(), |
353 GetHashState())); | 356 GetHashState())); |
354 } | 357 } |
355 | 358 |
356 // static | 359 // static |
357 int DownloadFile::GetNumberOfDownloadFiles() { | 360 int DownloadFile::GetNumberOfDownloadFiles() { |
358 return number_active_objects_; | 361 return number_active_objects_; |
359 } | 362 } |
360 | 363 |
361 } // namespace content | 364 } // namespace content |
OLD | NEW |