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

Side by Side Diff: ui/file_manager/gallery/js/gallery_item.js

Issue 2629133002: Avoid UI unresponsiveness when switching between large images. (Closed)
Patch Set: Remove @private from the constant to be consistent with others. Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/image_editor/image_view.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Object representing an image item (a photo). 6 * Object representing an image item (a photo).
7 * 7 *
8 * @param {!FileEntry} entry Image entry. 8 * @param {!FileEntry} entry Image entry.
9 * @param {!EntryLocation} locationInfo Entry location information. 9 * @param {!EntryLocation} locationInfo Entry location information.
10 * @param {MetadataItem} metadataItem 10 * @param {MetadataItem} metadataItem
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 return Promise.reject(str('GALLERY_FILE_EXISTS')); 433 return Promise.reject(str('GALLERY_FILE_EXISTS'));
434 }, function() { 434 }, function() {
435 return new Promise( 435 return new Promise(
436 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); 436 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName));
437 }.bind(this)); 437 }.bind(this));
438 }.bind(this)); 438 }.bind(this));
439 }.bind(this)).then(function(entry) { 439 }.bind(this)).then(function(entry) {
440 this.entry_ = entry; 440 this.entry_ = entry;
441 }.bind(this)); 441 }.bind(this));
442 }; 442 };
443
444 /**
445 * The threshold size of an image in pixels, which we always use thumbnail
446 * image for slide-in animation above this. This is a hack to avoid an UI
447 * unresponsiveness when switching between images.
448 * @type {number}
449 * @const
450 */
451 GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS = 4000 * 3000;
452
453 /**
454 * Whether the image requires long rendering time.
455 *
456 * @return {boolean}
457 */
458 GalleryItem.prototype.requireLongRenderingTime = function() {
459 // Check for undefined values.
460 if (!this.metadataItem_ ||
461 !this.metadataItem_.imageHeight || !this.metadataItem_.imageWidth)
462 return false;
463 var numPixels = this.metadataItem_.imageHeight *
464 this.metadataItem_.imageWidth;
465 return numPixels > GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS;
466 };
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/image_editor/image_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698