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

Unified Diff: chrome/browser/ui/views/download/download_item_view.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: chrome/browser/ui/views/download/download_item_view.cc
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index a11d7ed032d861c5e6132e546fb860da4064ce00..6e3e8b85ad157100b3ad4ce7dca76335d9d73120 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -236,21 +236,16 @@ DownloadItemView::~DownloadItemView() {
// Progress animation handlers.
void DownloadItemView::StartDownloadProgress() {
- if (progress_timer_.IsRunning())
+ if (progress_start_time_ != base::TimeTicks())
return;
progress_start_time_ = base::TimeTicks::Now();
- progress_timer_.Start(
- FROM_HERE,
- base::TimeDelta::FromMilliseconds(DownloadShelf::kProgressRateMs),
asanka 2015/12/18 03:39:16 Would you be willing to get rid of this 30ms timer
Evan Stade 2015/12/18 19:01:38 yea I meant to look at doing that, thanks for remi
Evan Stade 2015/12/29 18:50:49 This seems complicated enough that I'd want someon
- base::Bind(&DownloadItemView::SchedulePaint, base::Unretained(this)));
}
void DownloadItemView::StopDownloadProgress() {
- if (!progress_timer_.IsRunning())
+ if (progress_start_time_ == base::TimeTicks())
return;
previous_progress_elapsed_ += base::TimeTicks::Now() - progress_start_time_;
progress_start_time_ = base::TimeTicks();
- progress_timer_.Stop();
}
void DownloadItemView::OnExtractIconComplete(gfx::Image* icon_bitmap) {
@@ -284,6 +279,7 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download_item) {
case DownloadItem::IN_PROGRESS:
download()->IsPaused() ?
StopDownloadProgress() : StartDownloadProgress();
+ SchedulePaint();
LoadIconIfItemPathChanged();
break;
case DownloadItem::INTERRUPTED:
@@ -327,11 +323,6 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download_item) {
}
UpdateAccessibleName();
-
- // We use the parent's (DownloadShelfView's) SchedulePaint, since there
- // are spaces between each DownloadItemView that the parent is responsible
- // for painting.
- shelf_->SchedulePaint();
}
void DownloadItemView::OnDownloadDestroyed(DownloadItem* download) {

Powered by Google App Engine
This is Rietveld 408576698