Commit 55d99a69 authored by Charlene Yan's avatar Charlene Yan Committed by Commit Bot

Reland "[Tab Groups] Implement time to switch histogram."

This reverts commit f5a4e592.

Reason for revert: Relanding with memory issues addressed

Original change's description:
> Revert "[Tab Groups] Implement time to switch histogram."
> 
> This reverts commit 19b7b019.
> 
> Reason for revert: Likely causing failures for TabHoverCardBubbleViewBrowserTest.WidgetNotVisibleOnClick 
> TabHoverCardBubbleViewBrowserTest.WidgetNotVisibleOnMousePressAfterTabFocus on Linux MSan
> 
> Bug:1047172
> 
> Original change's description:
> > [Tab Groups] Implement time to switch histogram.
> > 
> > Records the amount of time in ms from the cursor entering the tabstrip
> > to tapping on a tab to switch.
> > 
> > Bug: 1040657
> > Change-Id: I438f53c3d3a83cead9a3feb0c62356e1322cf1c6
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2023396
> > Reviewed-by: Jesse Doherty <jwd@chromium.org>
> > Reviewed-by: Connie Wan <connily@chromium.org>
> > Commit-Queue: Charlene Yan <cyan@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#736721}
> 
> TBR=jwd@chromium.org,cyan@chromium.org,connily@chromium.org
> 
> Change-Id: Iff213feb375e247f59ce79c72616abaf164a35d1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 1040657
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2030664
> Reviewed-by: Ioana Pandele <ioanap@chromium.org>
> Commit-Queue: Ioana Pandele <ioanap@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#736842}

TBR=jwd@chromium.org,ioanap@chromium.org,cyan@chromium.org,connily@chromium.org

Change-Id: I6ebcffc8f0b0307ce0a3ff5598fab64a870af43b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1047172, 1040657
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2031562Reviewed-by: default avatarCharlene Yan <cyan@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Charlene Yan <cyan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737027}
parent 4051d624
......@@ -1798,6 +1798,16 @@ const Tab* TabStrip::GetAdjacentTab(const Tab* tab, int offset) {
void TabStrip::OnMouseEventInTab(views::View* source,
const ui::MouseEvent& event) {
// Record time from cursor entering the tabstrip to first tap on a tab to
// switch.
if (mouse_entered_tabstrip_time_.has_value() &&
event.type() == ui::ET_MOUSE_PRESSED &&
!strcmp(source->GetClassName(), Tab::kViewClassName)) {
UMA_HISTOGRAM_MEDIUM_TIMES(
"TabStrip.TimeToSwitch",
base::TimeTicks::Now() - mouse_entered_tabstrip_time_.value());
mouse_entered_tabstrip_time_.reset();
}
UpdateStackedLayoutFromMouseEvent(source, event);
}
......@@ -3462,6 +3472,7 @@ void TabStrip::OnMouseMoved(const ui::MouseEvent& event) {
}
void TabStrip::OnMouseEntered(const ui::MouseEvent& event) {
mouse_entered_tabstrip_time_ = base::TimeTicks::Now();
SetResetToShrinkOnExit(true);
}
......
......@@ -739,6 +739,9 @@ class TabStrip : public views::AccessiblePaneView,
// Time of the last mouse move event.
base::TimeTicks last_mouse_move_time_;
// Used for seek time metrics from the time the mouse enters the tabstrip.
base::Optional<base::TimeTicks> mouse_entered_tabstrip_time_;
// Number of mouse moves.
int mouse_move_count_ = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment