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

Unified Diff: chrome/browser/resources/media_router/elements/route_controls/route_controls.js

Issue 2915983002: [Media Router] Add UMA metrics to record the load time for route controls (Closed)
Patch Set: . Created 3 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/media_router/elements/route_controls/route_controls.js
diff --git a/chrome/browser/resources/media_router/elements/route_controls/route_controls.js b/chrome/browser/resources/media_router/elements/route_controls/route_controls.js
index 4d3a65bc61b8b87fbab79581dc093b0bd3a33a32..420e31eb9fd5be27b01145bc32457441c2cd3068 100644
--- a/chrome/browser/resources/media_router/elements/route_controls/route_controls.js
+++ b/chrome/browser/resources/media_router/elements/route_controls/route_controls.js
@@ -40,6 +40,15 @@ Polymer({
},
/**
+ * The time when the initial media status was loaded.
+ * @private {?Date}
+ */
+ initialLoadTime_: {
+ type: Date,
+ value: null,
+ },
+
+ /**
* Set to true when the user is dragging the seek bar. Updates for the
* current time from the browser will be ignored when set to true.
* @private {boolean}
@@ -60,6 +69,16 @@ Polymer({
},
/**
+ * The time when the route details view was opened.
+ * @type {?Date}
+ */
+ routeDetailsOpenTime: {
+ type: Date,
+ value: null,
+ observer: 'onRouteDetailsOpenTimeSet_',
imcheng 2017/06/02 23:53:13 We can use maybeReportLoadTime_ here. Then we won'
takumif 2017/06/03 01:31:14 Right, the observer is no longer necessary. Remove
+ },
+
+ /**
* The status of the media route shown.
* @type {!media_router.RouteStatus}
*/
@@ -148,6 +167,19 @@ Polymer({
},
/**
+ * Notify the browser the time it took from opening the route details view to
+ * loading the route controller if the data is available.
+ *
+ * @private
+ */
+ maybeReportLoadTime_: function() {
+ if (this.initialLoadTime_ && this.routeDetailsOpenTime) {
+ var timeMs = this.initialLoadTime_ - this.routeDetailsOpenTime;
+ media_router.browserApi.reportWebUIRouteControllerLoaded(timeMs);
+ }
+ },
+
+ /**
* Called when the user toggles the mute status of the media. Sends a mute or
* unmute command to the browser.
*
@@ -181,6 +213,15 @@ Polymer({
},
/**
+ * Called when |routeDetailsOpenTime| is set.
+ *
+ * @private
+ */
+ onRouteDetailsOpenTimeSet_: function() {
+ this.maybeReportLoadTime_();
+ },
+
+ /**
* Updates seek and volume bars if the user is not currently dragging on
* them.
* @param {!media_router.RouteStatus} newRouteStatus
@@ -197,6 +238,10 @@ Polymer({
if (newRouteStatus.description !== '') {
this.displayedDescription_ = newRouteStatus.description;
}
+ if (!this.initialLoadTime_) {
+ this.initialLoadTime_ = new Date();
imcheng 2017/06/02 23:53:13 Date.now()
takumif 2017/06/03 01:31:14 Done.
+ this.maybeReportLoadTime_();
+ }
},
/**

Powered by Google App Engine
This is Rietveld 408576698