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

Unified Diff: chrome/browser/resources/file_manager/js/file_grid.js

Issue 15809008: Make resizing in Files.app more responsive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_grid.js
diff --git a/chrome/browser/resources/file_manager/js/file_grid.js b/chrome/browser/resources/file_manager/js/file_grid.js
index fdd71affad06e10126761ba5f02e4067ed1dd273..ba6c20164c27ef0370290742f870b0482843dd7e 100644
--- a/chrome/browser/resources/file_manager/js/file_grid.js
+++ b/chrome/browser/resources/file_manager/js/file_grid.js
@@ -40,6 +40,9 @@ FileGrid.decorate = function(self, metadataCache) {
FileGrid.Item.decorate(item, entry, self);
return item;
};
+
+ self.relayoutAggregation_ =
+ new AsyncUtil.Aggregation(self.relayoutImmediately_.bind(self));
};
/**
@@ -64,18 +67,19 @@ FileGrid.prototype.updateListItemsMetadata = function(type, props) {
* Redraws the UI. Skips multiple consecutive calls.
*/
FileGrid.prototype.relayout = function() {
- if (this.resizeGridTimer_) {
- clearTimeout(this.resizeGridTimer_);
- this.resizeGridTimer_ = null;
- }
- this.resizeGridTimer_ = setTimeout(function() {
- this.startBatchUpdates();
- this.columns = 0;
- this.redraw();
- cr.dispatchSimpleEvent(this, 'relayout');
- this.endBatchUpdates();
- this.resizeGridTimer_ = null;
- }.bind(this), 100);
+ this.relayoutAggregation_.run();
+};
+
+/**
+ * Redraws the UI immediately.
+ * @private
+ */
+FileGrid.prototype.relayoutImmediately_ = function() {
+ this.startBatchUpdates();
+ this.columns = 0;
+ this.redraw();
+ this.endBatchUpdates();
+ cr.dispatchSimpleEvent(this, 'relayout');
};
/**
« no previous file with comments | « chrome/browser/resources/file_manager/js/async_util.js ('k') | chrome/browser/resources/file_manager/js/file_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698