summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhirono <hirono@chromium.org>2015-04-02 22:06:10 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-03 05:06:55 +0000
commit65cd862d0ba40f3fc93e5910aa8a81819748393b (patch)
treed0ad98b03c9f511570ffffcb4ac4fc000e4de3c3
parentd3145c8315ae29cefae2e030bbaacbdc68551fd9 (diff)
downloadchromium_src-65cd862d0ba40f3fc93e5910aa8a81819748393b.zip
chromium_src-65cd862d0ba40f3fc93e5910aa8a81819748393b.tar.gz
chromium_src-65cd862d0ba40f3fc93e5910aa8a81819748393b.tar.bz2
Gallery: Remove redundant prefetching.
* Currently cache of slide image is managed by GalleryItem. So we don't need to prefetch images to update cache last accessed time. * We should not start another prefetch request if we have already started prefetch for the entry. * Remove unused inline function. BUG=None TEST=None Review URL: https://codereview.chromium.org/1053993002 Cr-Commit-Position: refs/heads/master@{#323598}
-rw-r--r--ui/file_manager/gallery/js/image_editor/image_view.js2
-rw-r--r--ui/file_manager/gallery/js/slide_mode.js21
2 files changed, 1 insertions, 22 deletions
diff --git a/ui/file_manager/gallery/js/image_editor/image_view.js b/ui/file_manager/gallery/js/image_editor/image_view.js
index ea37399..76b837f 100644
--- a/ui/file_manager/gallery/js/image_editor/image_view.js
+++ b/ui/file_manager/gallery/js/image_editor/image_view.js
@@ -498,7 +498,7 @@ ImageView.prototype.load =
* @param {number=} opt_delay Image load delay in ms.
*/
ImageView.prototype.prefetch = function(item, opt_delay) {
- if (item.contentImage)
+ if (item.contentImage || this.prefetchLoader_.isLoading(item.getEntry()))
return;
this.prefetchLoader_.load(item, function(canvas) {
if (canvas.width && canvas.height && !item.contentImage)
diff --git a/ui/file_manager/gallery/js/slide_mode.js b/ui/file_manager/gallery/js/slide_mode.js
index 5095dfd..5451ebe 100644
--- a/ui/file_manager/gallery/js/slide_mode.js
+++ b/ui/file_manager/gallery/js/slide_mode.js
@@ -515,21 +515,6 @@ SlideMode.prototype.enter = function(
this.sequenceDirection_ = 0;
this.sequenceLength_ = 0;
- var loadDone = function(loadType, delay) {
- this.active_ = true;
-
- this.selectionModel_.addEventListener('change', this.onSelectionBound_);
- this.dataModel_.addEventListener('splice', this.onSpliceBound_);
-
- ImageUtil.setAttribute(this.arrowBox_, 'active', this.getItemCount_() > 1);
- this.ribbon_.enable();
-
- // Wait 1000ms after the animation is done, then prefetch the next image.
- this.requestPrefetch(1, delay + 1000);
-
- if (loadCallback) loadCallback();
- }.bind(this);
-
// The latest |leave| call might have left the image animating. Remove it.
this.unloadImage_();
@@ -775,12 +760,6 @@ SlideMode.prototype.loadSelectedItem_ = function() {
this.displayedItem_ = this.getSelectedItem();
var selectedItem = assertInstanceof(this.getSelectedItem(), Gallery.Item);
- if (this.sequenceLength_ <= 1) {
- // We have just broke the sequence. Touch the current image so that it stays
- // in the cache longer.
- this.imageView_.prefetch(selectedItem);
- }
-
function shouldPrefetch(loadType, step, sequenceLength) {
// Never prefetch when selecting out of sequence.
if (Math.abs(step) != 1)