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

Unified Diff: chrome/browser/resources/md_downloads/manager.js

Issue 2592573002: MD Downloads: add first meaningful paint metrics to UMA (Closed)
Patch Set: -history Created 4 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/resources/md_downloads/manager.js
diff --git a/chrome/browser/resources/md_downloads/manager.js b/chrome/browser/resources/md_downloads/manager.js
index 62b6b3492368a95b62ff608fb8cb03c170e82078..743aacd19af0b0cbe9fcdc33e7b1f5e694e74580 100644
--- a/chrome/browser/resources/md_downloads/manager.js
+++ b/chrome/browser/resources/md_downloads/manager.js
@@ -52,6 +52,9 @@ cr.define('downloads', function() {
'itemsChanged_(items_.*)',
],
+ /** @private {!PromiseResolver} */
+ loaded_: new PromiseResolver,
+
/** @private */
clearAll_: function() {
this.set('items_', []);
@@ -74,7 +77,12 @@ cr.define('downloads', function() {
insertItems_: function(index, list) {
this.splice.apply(this, ['items_', index, 0].concat(list));
this.updateHideDates_(index, index + list.length);
- this.removeAttribute('loading');
+
+ if (this.hasAttribute('loading')) {
+ this.removeAttribute('loading');
+ this.loaded_.resolve();
+ }
+
this.spinnerActive_ = false;
},
@@ -134,13 +142,17 @@ cr.define('downloads', function() {
this.hasShadow_ = list.scrollTop > 0;
},
- /** @private */
+ /**
+ * @return {!Promise}
+ * @private
+ */
onLoad_: function() {
cr.ui.decorate('command', cr.ui.Command);
document.addEventListener('canExecute', this.onCanExecute_.bind(this));
document.addEventListener('command', this.onCommand_.bind(this));
downloads.ActionService.getInstance().loadMore();
+ return this.loaded_.promise;
},
/** @private */
@@ -201,8 +213,9 @@ cr.define('downloads', function() {
Manager.get().insertItems_(index, list);
};
+ /** @return {!Promise} */
Manager.onLoad = function() {
- Manager.get().onLoad_();
+ return Manager.get().onLoad_();
};
Manager.removeItem = function(index) {
« no previous file with comments | « chrome/browser/resources/md_downloads/downloads.js ('k') | chrome/browser/ui/webui/md_downloads/md_downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698