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

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

Issue 1538773002: Reduce CPU usage of download shelf UI. (both MD and pre-MD shelves) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years 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_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index cf4294485a94276b72f032e45cb5f579e315cf18..f36b4b086c392b99038bbc65bccd5220ed6ed230 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -1038,6 +1038,8 @@ void DownloadItemImpl::DestinationUpdate(int64 bytes_so_far,
// reporting.
return;
}
+
+ int previous_progress = PercentComplete();
bytes_per_sec_ = bytes_per_sec;
hash_state_ = hash_state;
received_bytes_ = bytes_so_far;
@@ -1053,7 +1055,10 @@ void DownloadItemImpl::DestinationUpdate(int64 bytes_so_far,
net::NetLog::Int64Callback("bytes_so_far", received_bytes_));
}
- UpdateObservers();
+ // Don't bother to update observers unless the progress percentage has
+ // actually changed.
+ if (previous_progress != -1 && PercentComplete() != previous_progress)
asanka 2015/12/18 03:39:16 This change places the responsibility of throttlin
Evan Stade 2015/12/18 19:01:38 My justification for putting the responsibility he
Evan Stade 2015/12/29 18:57:03 reverted this change
+ UpdateObservers();
}
void DownloadItemImpl::DestinationError(DownloadInterruptReason reason) {

Powered by Google App Engine
This is Rietveld 408576698