Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Side by Side Diff: content/browser/download/download_file_impl.cc

Issue 1648683002: [Merge to 49] [Downloads] Avoid resetting SecureHash state across an interruption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698