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

Unified Diff: content/browser/download/download_file_impl.cc

Issue 14697023: downloads: Improve download rate estimation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename and comment Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_file_impl.cc
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index 9c064d20c4edb9003eb6fc74fe782a8be9db49b7..1c0b384cbeabe81034219b2dc4ae04abd8094963 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -98,6 +98,7 @@ DownloadInterruptReason DownloadFileImpl::AppendDataToFile(
base::TimeDelta::FromMilliseconds(kUpdatePeriodMs),
this, &DownloadFileImpl::SendUpdate);
}
+ rate_estimator_.Increment(data_len);
return file_.AppendDataToFile(data, data_len);
}
@@ -191,7 +192,7 @@ int64 DownloadFileImpl::BytesSoFar() const {
}
int64 DownloadFileImpl::CurrentSpeed() const {
- return file_.CurrentSpeed();
+ return rate_estimator_.GetCountPerSecond();
}
bool DownloadFileImpl::GetHash(std::string* hash) {

Powered by Google App Engine
This is Rietveld 408576698