Chromium Code Reviews| Index: chrome/browser/resources/downloads/downloads.js |
| diff --git a/chrome/browser/resources/downloads/downloads.js b/chrome/browser/resources/downloads/downloads.js |
| index dba578db7e4045355197d2a87bbc8192591548b7..0a1a033f963e728b99f6f792ee48e2c1cf58433d 100644 |
| --- a/chrome/browser/resources/downloads/downloads.js |
| +++ b/chrome/browser/resources/downloads/downloads.js |
| @@ -101,6 +101,13 @@ function Downloads() { |
| // Icon load request queue. |
| this.iconLoadQueue_ = []; |
| this.isIconLoading_ = false; |
| + |
| + this.progressForeground1_ = new Image(); |
| + this.progressForeground1_.src = |
| + 'chrome://theme/IDR_DOWNLOAD_PROGRESS_FOREGROUND_32@1x'; |
| + this.progressForeground2_ = new Image(); |
| + this.progressForeground2_.src = |
| + 'chrome://theme/IDR_DOWNLOAD_PROGRESS_FOREGROUND_32@2x'; |
| } |
| /** |
| @@ -486,15 +493,6 @@ computeDownloadProgress(); |
| window.matchMedia(media).addListener(computeDownloadProgress); |
|
asanka
2014/08/29 15:48:14
Perhaps just call getCachedImage('...' + scale + '
|
| }); |
| -var ImageCache = {}; |
| -function getCachedImage(src) { |
| - if (!ImageCache[src]) { |
| - ImageCache[src] = new Image(); |
| - ImageCache[src].src = src; |
| - } |
| - return ImageCache[src]; |
| -} |
| - |
| /** |
| * Updates the download to reflect new data. |
| * @param {BackendDownloadObject} download A backend download object |
| @@ -559,9 +557,8 @@ Download.prototype.update = function(download) { |
| this.nodeProgressForeground_.width = Download.Progress.width; |
| this.nodeProgressForeground_.height = Download.Progress.height; |
| - var foregroundImage = getCachedImage( |
| - 'chrome://theme/IDR_DOWNLOAD_PROGRESS_FOREGROUND_32@' + |
| - window.devicePixelRatio + 'x'); |
| + var foregroundImage = (window.devicePixelRatio < 2) ? |
| + downloads.progressForeground1_ : downloads.progressForeground2_; |
|
asanka
2014/08/25 19:09:02
Is this enough? If this is the underlying cause th
benjhayden
2014/08/25 21:36:18
I believe I just found root cause: the canvas is n
asanka
2014/08/26 14:51:00
There appears to be a listener for devicePixelRati
benjhayden
2014/08/26 15:52:38
The dPR change listener is reliable, so, yes we co
asanka
2014/08/28 16:23:50
I think I understand the problem better and I'm ok
benjhayden
2014/08/28 17:00:53
Yes. dPR can take on 16 different values, one for
asanka
2014/08/29 15:48:14
Ah. Got it. Thanks for the explanation.
Prefetchi
|
| // Draw a pie-slice for the progress. |
| this.canvasProgress_.globalCompositeOperation = 'copy'; |