Index: content/browser/download/base_file.cc |
diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc |
index 687c321c9c8d212d983b4492399ef8de41a0ad80..f31a0646761361b07206481f739ecf300029766e 100644 |
--- a/content/browser/download/base_file.cc |
+++ b/content/browser/download/base_file.cc |
@@ -137,6 +137,7 @@ DownloadInterruptReason BaseFile::AppendDataToFile(const char* data, |
len -= write_size; |
current_data += write_size; |
bytes_so_far_ += write_size; |
+ rate_estimator_.AddBytes(write_size); |
} |
RecordDownloadWriteSize(data_len); |
@@ -340,9 +341,7 @@ void BaseFile::ClearStream() { |
} |
int64 BaseFile::CurrentSpeedAtTime(base::TimeTicks current_time) const { |
- base::TimeDelta diff = current_time - start_tick_; |
- int64 diff_ms = diff.InMilliseconds(); |
- return diff_ms == 0 ? 0 : bytes_so_far() * 1000 / diff_ms; |
+ return rate_estimator_.GetBytesPerSecond(); |
} |
DownloadInterruptReason BaseFile::LogNetError( |