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

Unified Diff: chrome/browser/resources/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: 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
Index: chrome/browser/resources/history/history.js
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js
index 7643b8fd336866b834cfcf4ee793251c74102bde..b22f731a3cdabf1e3d4893e3e19c651d87a166ac 100644
--- a/chrome/browser/resources/history/history.js
+++ b/chrome/browser/resources/history/history.js
@@ -75,6 +75,14 @@ function recordUmaHistogram(histogram, maxBucketValue, value) {
maxBucketValue]);
}
+/**
+ * Record the current time in milliseconds since pageload into a UMA histogram.
+ * @param {string} histogram The name of the histogram to be recorded in.
+ */
+function recordTimeHistogram(histogram) {
calamity 2016/08/03 08:23:22 Is this worth moving into cr_util.js?
calamity 2016/08/03 08:23:22 Param no longer needed?
Dan Beam 2016/08/03 21:05:17 why not just inline this method? it's only used o
tsergeant 2016/08/03 22:53:56 Sure, inlined.
+ chrome.send('metricsHandler:recordTime', [histogram, performance.now()]);
+}
+
///////////////////////////////////////////////////////////////////////////////
// Visit:
@@ -939,6 +947,7 @@ function HistoryView(model) {
this.model_ = model;
this.pageIndex_ = 0;
this.lastDisplayed_ = [];
+ this.hasRenderedResults_ = false;
this.model_.setView(this);
@@ -1122,6 +1131,13 @@ HistoryView.prototype.onModelReady = function(doneLoading) {
var isSearch = this.model_.getSearchText().length > 0;
$('search-field').hidden = !(hasResults || isSearch);
}
+
+ if (!this.hasRenderedResults_) {
+ this.hasRenderedResults_ = true;
+ requestAnimationFrame(function() {
tsergeant 2016/08/03 07:37:04 I have two main options here: * requestAnimationF
calamity 2016/08/03 08:23:23 rAF sgtm.
+ recordTimeHistogram('History.ResultsRenderedTime');
+ });
+ }
};
/**

Powered by Google App Engine
This is Rietveld 408576698