Commit f633a570 authored by Ryan Daum's avatar Ryan Daum Committed by Commit Bot

[chromecast] Time system gesture events for diagnostics.

Provide VLOGging of system gesture event timing metrics.

Bug: internal b/110376393
Test: manual
Change-Id: I5fa2c1ac52b02d3b81653bab485cd5379dc07944
Reviewed-on: https://chromium-review.googlesource.com/1108157Reviewed-by: default avatarAlex Sakhartchouk <alexst@chromium.org>
Commit-Queue: Ryan Daum <rdaum@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568954}
parent fbb3fd37
...@@ -32,6 +32,8 @@ void CastGestureDispatcher::HandleSideSwipeBegin( ...@@ -32,6 +32,8 @@ void CastGestureDispatcher::HandleSideSwipeBegin(
const gfx::Point& touch_location) { const gfx::Point& touch_location) {
if (swipe_origin == CastSideSwipeOrigin::LEFT) { if (swipe_origin == CastSideSwipeOrigin::LEFT) {
dispatched_back_ = false; dispatched_back_ = false;
VLOG(1) << "swipe gesture begin";
current_swipe_time_ = base::ElapsedTimer();
} }
} }
...@@ -47,9 +49,14 @@ void CastGestureDispatcher::HandleSideSwipeContinue( ...@@ -47,9 +49,14 @@ void CastGestureDispatcher::HandleSideSwipeContinue(
} }
delegate_->GestureProgress(GestureType::GO_BACK, touch_location); delegate_->GestureProgress(GestureType::GO_BACK, touch_location);
VLOG(1) << "swipe gesture continue, elapsed time: "
<< current_swipe_time_.Elapsed().InMilliseconds() << "ms";
if (!dispatched_back_ && touch_location.x() >= horizontal_threshold_) { if (!dispatched_back_ && touch_location.x() >= horizontal_threshold_) {
dispatched_back_ = true; dispatched_back_ = true;
delegate_->ConsumeGesture(GestureType::GO_BACK); delegate_->ConsumeGesture(GestureType::GO_BACK);
VLOG(1) << "swipe gesture complete, elapsed time: "
<< current_swipe_time_.Elapsed().InMilliseconds() << "ms";
} }
} }
...@@ -59,10 +66,13 @@ void CastGestureDispatcher::HandleSideSwipeEnd( ...@@ -59,10 +66,13 @@ void CastGestureDispatcher::HandleSideSwipeEnd(
if (swipe_origin != CastSideSwipeOrigin::LEFT) { if (swipe_origin != CastSideSwipeOrigin::LEFT) {
return; return;
} }
VLOG(1) << "swipe end, elapsed time: "
<< current_swipe_time_.Elapsed().InMilliseconds() << "ms";
if (!delegate_->CanHandleGesture(GestureType::GO_BACK)) { if (!delegate_->CanHandleGesture(GestureType::GO_BACK)) {
return; return;
} }
if (!dispatched_back_ && touch_location.x() < horizontal_threshold_) { if (!dispatched_back_ && touch_location.x() < horizontal_threshold_) {
VLOG(1) << "swipe gesture cancelled";
delegate_->CancelGesture(GestureType::GO_BACK, touch_location); delegate_->CancelGesture(GestureType::GO_BACK, touch_location);
} }
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define CHROMECAST_BROWSER_CAST_GESTURE_DISPATCHER_H_ #define CHROMECAST_BROWSER_CAST_GESTURE_DISPATCHER_H_
#include "base/macros.h" #include "base/macros.h"
#include "base/timer/elapsed_timer.h"
#include "chromecast/browser/cast_content_window.h" #include "chromecast/browser/cast_content_window.h"
#include "chromecast/graphics/cast_gesture_handler.h" #include "chromecast/graphics/cast_gesture_handler.h"
...@@ -34,6 +35,7 @@ class CastGestureDispatcher : public CastGestureHandler { ...@@ -34,6 +35,7 @@ class CastGestureDispatcher : public CastGestureHandler {
const int horizontal_threshold_; const int horizontal_threshold_;
CastContentWindow::Delegate* const delegate_; CastContentWindow::Delegate* const delegate_;
bool dispatched_back_; bool dispatched_back_;
base::ElapsedTimer current_swipe_time_;
}; };
} // namespace shell } // namespace shell
......
...@@ -108,6 +108,8 @@ void CastSystemGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) { ...@@ -108,6 +108,8 @@ void CastSystemGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) {
// Let the subscriber know about the gesture begin. // Let the subscriber know about the gesture begin.
gesture_handler->HandleSideSwipeBegin(side_swipe_origin, gesture_handler->HandleSideSwipeBegin(side_swipe_origin,
touch_location); touch_location);
VLOG(1) << "side swipe gesture begin @ " << touch_location.ToString();
current_swipe_time_ = base::ElapsedTimer();
} }
} }
...@@ -124,6 +126,9 @@ void CastSystemGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) { ...@@ -124,6 +126,9 @@ void CastSystemGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) {
// The system gesture has ended. // The system gesture has ended.
if (event->type() == ui::ET_TOUCH_RELEASED) { if (event->type() == ui::ET_TOUCH_RELEASED) {
VLOG(1) << "gesture release; time since press: "
<< current_swipe_time_.Elapsed().InMilliseconds() << "ms @ "
<< touch_location.ToString();
for (auto* gesture_handler : gesture_handlers_) { for (auto* gesture_handler : gesture_handlers_) {
gesture_handler->HandleSideSwipeEnd(current_swipe_, touch_location); gesture_handler->HandleSideSwipeEnd(current_swipe_, touch_location);
} }
...@@ -136,6 +141,9 @@ void CastSystemGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) { ...@@ -136,6 +141,9 @@ void CastSystemGestureEventHandler::OnTouchEvent(ui::TouchEvent* event) {
for (auto* gesture_handler : gesture_handlers_) { for (auto* gesture_handler : gesture_handlers_) {
// Let the subscriber know about the gesture begin. // Let the subscriber know about the gesture begin.
gesture_handler->HandleSideSwipeContinue(current_swipe_, touch_location); gesture_handler->HandleSideSwipeContinue(current_swipe_, touch_location);
VLOG(1) << "gesture continue; time since press: "
<< current_swipe_time_.Elapsed().InMilliseconds() << "ms @ "
<< touch_location.ToString();
} }
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/containers/flat_set.h" #include "base/containers/flat_set.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/timer/elapsed_timer.h"
#include "chromecast/graphics/cast_gesture_handler.h" #include "chromecast/graphics/cast_gesture_handler.h"
#include "ui/events/event_handler.h" #include "ui/events/event_handler.h"
...@@ -50,6 +51,7 @@ class CastSystemGestureEventHandler : public ui::EventHandler { ...@@ -50,6 +51,7 @@ class CastSystemGestureEventHandler : public ui::EventHandler {
aura::Window* root_window_; aura::Window* root_window_;
CastSideSwipeOrigin current_swipe_; CastSideSwipeOrigin current_swipe_;
base::ElapsedTimer current_swipe_time_;
base::flat_set<CastGestureHandler*> gesture_handlers_; base::flat_set<CastGestureHandler*> gesture_handlers_;
......
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