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

Unified Diff: chrome/browser/resources/md_history/history.js

Issue 2203263002: History: Add load-time metric for non-MD and MD History WebUI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: isherman@ review Created 4 years, 4 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
« no previous file with comments | « chrome/browser/resources/history/history.js ('k') | chrome/browser/ui/webui/metrics_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_history/history.js
diff --git a/chrome/browser/resources/md_history/history.js b/chrome/browser/resources/md_history/history.js
index 0c456c7dfb77adc715cbb04618f4224bb7634294..4cce580cc9e8ccc0e21f3930cb76b28bed560a43 100644
--- a/chrome/browser/resources/md_history/history.js
+++ b/chrome/browser/resources/md_history/history.js
@@ -9,6 +9,8 @@ chrome.send('getForeignSessions');
/** @type {Promise} */
var upgradePromise = null;
+/** @type {boolean} */
+var resultsRendered = false;
/**
* @return {!Promise} Resolves once the history-app has been fully upgraded.
@@ -38,10 +40,18 @@ function historyResult(info, results) {
waitForAppUpgrade().then(function() {
/** @type {HistoryAppElement} */($('history-app'))
.historyResult(info, results);
- // TODO(tsergeant): Showing everything as soon as the list is ready is not
- // ideal, as the sidebar can still pop in after. Fix this to show everything
- // at once.
document.body.classList.remove('loading');
+
+ if (!resultsRendered) {
+ resultsRendered = true;
+ // requestAnimationFrame allows measurement immediately before the next
+ // repaint, but after the first page of <iron-list> items has stamped.
+ requestAnimationFrame(function() {
+ chrome.send(
+ 'metricsHandler:recordTime',
+ ['History.ResultsRenderedTime', window.performance.now()]);
+ });
+ }
});
}
« no previous file with comments | « chrome/browser/resources/history/history.js ('k') | chrome/browser/ui/webui/metrics_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698