Record WebUI Tabstrip Activation Duration
Sample Histogram Recording
Histogram: WebUITabStrip.TabActivation recorded 8 samples, mean = 15.4 (flags = 0x41)
0 ...
14 ------------------------------------------------------------------------O (7 = 87.5%) {0.0%}
17 ----------O (1 = 12.5%) {87.5%}
20 ...
BUG=1016031
Change-Id: I07a59e7f2928e5eb6031afeced7c83ac494b020b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1930251
Commit-Queue: Robert Liao <[email protected]>
Reviewed-by: John Lee <[email protected]>
Reviewed-by: Nik Bhagat <[email protected]>
Auto-Submit: Robert Liao <[email protected]>
Cr-Commit-Position: refs/heads/master@{#721316}
diff --git a/chrome/browser/resources/tab_strip/tab.js b/chrome/browser/resources/tab_strip/tab.js
index d60ec11..d64f93c 100644
--- a/chrome/browser/resources/tab_strip/tab.js
+++ b/chrome/browser/resources/tab_strip/tab.js
@@ -104,6 +104,9 @@
/** @private @const {!TabSwiper} */
this.tabSwiper_ = new TabSwiper(this);
+
+ /** @private {!Function} */
+ this.onTabActivating_ = (tabId) => {};
}
/** @return {!TabData} */
@@ -169,6 +172,11 @@
this.tab_ = Object.freeze(tab);
}
+ /** @param {!Function} callback */
+ set onTabActivating(callback) {
+ this.onTabActivating_ = callback;
+ }
+
focus() {
this.tabEl_.focus();
}
@@ -191,7 +199,9 @@
return;
}
- this.tabsApi_.activateTab(this.tab_.id);
+ const tabId = this.tab_.id;
+ this.onTabActivating_(tabId);
+ this.tabsApi_.activateTab(tabId);
if (tabStripOptions.autoCloseEnabled) {
this.embedderApi_.closeContainer();