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

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

Issue 18284005: Make ByteStream independent from DownloadInterruptReason (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jam's comment Created 7 years, 4 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 | Annotate | Revision Log
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 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
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
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
OLDNEW
« no previous file with comments | « content/browser/byte_stream_unittest.cc ('k') | content/browser/download/download_file_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698