diff options
author | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-28 23:06:28 +0000 |
---|---|---|
committer | sadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-28 23:06:28 +0000 |
commit | 53299ccf7a2e76fca6dc8f5d7caab06d9596cb71 (patch) | |
tree | 5747549200d296e83245977aa39e5052f26c5799 /ash/touch | |
parent | 38f1c195df8b0ae6375750eb651c0fe117480cf6 (diff) | |
download | chromium_src-53299ccf7a2e76fca6dc8f5d7caab06d9596cb71.zip chromium_src-53299ccf7a2e76fca6dc8f5d7caab06d9596cb71.tar.gz chromium_src-53299ccf7a2e76fca6dc8f5d7caab06d9596cb71.tar.bz2 |
touch: Add a new metric.
BUG=162511
Review URL: https://codereview.chromium.org/11416188
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/touch')
-rw-r--r-- | ash/touch/touch_uma.cc | 29 | ||||
-rw-r--r-- | ash/touch/touch_uma.h | 8 |
2 files changed, 36 insertions, 1 deletions
diff --git a/ash/touch/touch_uma.cc b/ash/touch/touch_uma.cc index d8117b6..7ddfa19 100644 --- a/ash/touch/touch_uma.cc +++ b/ash/touch/touch_uma.cc @@ -7,6 +7,7 @@ #include "ash/shell_delegate.h" #include "base/metrics/histogram.h" #include "base/stringprintf.h" +#include "ui/aura/env.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_property.h" @@ -247,7 +248,9 @@ UMAEventType UMAEventTypeFromEvent(const ui::Event& event) { namespace ash { namespace internal { -TouchUMA::TouchUMA() { +TouchUMA::TouchUMA() + : touch_in_progress_(false), + burst_length_(0) { } TouchUMA::~TouchUMA() { @@ -284,6 +287,8 @@ void TouchUMA::RecordTouchEvent(aura::Window* target, static_cast<int>(std::max(event.radius_x(), event.radius_y())), 1, 500, 100); + UpdateBurstData(event); + WindowTouchDetails* details = target->GetProperty(kWindowTouchDetails); if (!details) { details = new WindowTouchDetails; @@ -388,5 +393,27 @@ void TouchUMA::RecordTouchEvent(aura::Window* target, } } +void TouchUMA::UpdateBurstData(const ui::TouchEvent& event) { + if (event.type() == ui::ET_TOUCH_PRESSED) { + if (!touch_in_progress_) { + base::TimeDelta difference = event.time_stamp() - last_touch_down_time_; + if (difference > base::TimeDelta::FromMilliseconds(250)) { + if (burst_length_) { + UMA_HISTOGRAM_COUNTS_100("Ash.TouchStartBurst", + std::min(burst_length_, 100)); + } + burst_length_ = 1; + } else { + ++burst_length_; + } + } + touch_in_progress_ = true; + last_touch_down_time_ = event.time_stamp(); + } else if (event.type() == ui::ET_TOUCH_RELEASED) { + if (!aura::Env::GetInstance()->is_touch_down()) + touch_in_progress_ = false; + } +} + } // namespace internal } // namespace ash diff --git a/ash/touch/touch_uma.h b/ash/touch/touch_uma.h index cab7edc..46805b1 100644 --- a/ash/touch/touch_uma.h +++ b/ash/touch/touch_uma.h @@ -31,6 +31,14 @@ class TouchUMA { const ui::TouchEvent& event); private: + void UpdateBurstData(const ui::TouchEvent& event); + + // These are used to measure the number of touch-start events we receive in a + // quick succession, regardless of the target window. + bool touch_in_progress_; + int burst_length_; + base::TimeDelta last_touch_down_time_; + DISALLOW_COPY_AND_ASSIGN(TouchUMA); }; |