summaryrefslogtreecommitdiffstats
path: root/ash/touch/touch_uma.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ash/touch/touch_uma.cc')
-rw-r--r--ash/touch/touch_uma.cc29
1 files changed, 28 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