| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/input/TouchEventManager.h" | 5 #include "core/input/TouchEventManager.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/events/TouchEvent.h" | 8 #include "core/events/TouchEvent.h" |
| 9 #include "core/frame/Deprecation.h" | 9 #include "core/frame/Deprecation.h" |
| 10 #include "core/frame/EventHandlerRegistry.h" | 10 #include "core/frame/EventHandlerRegistry.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 DispatchEventResult domDispatchResult = | 201 DispatchEventResult domDispatchResult = |
| 202 touchEventTarget->dispatchEvent(touchEvent); | 202 touchEventTarget->dispatchEvent(touchEvent); |
| 203 | 203 |
| 204 // Only report for top level documents with a single touch on | 204 // Only report for top level documents with a single touch on |
| 205 // touch-start or the first touch-move. | 205 // touch-start or the first touch-move. |
| 206 if (event.touchStartOrFirstTouchMove() && touchInfos.size() == 1 && | 206 if (event.touchStartOrFirstTouchMove() && touchInfos.size() == 1 && |
| 207 m_frame->isMainFrame()) { | 207 m_frame->isMainFrame()) { |
| 208 // Record the disposition and latency of touch starts and first touch | 208 // Record the disposition and latency of touch starts and first touch |
| 209 // moves before and after the page is fully loaded respectively. | 209 // moves before and after the page is fully loaded respectively. |
| 210 int64_t latencyInMicros = static_cast<int64_t>( | 210 int64_t latencyInMicros = |
| 211 (monotonicallyIncreasingTime() - event.timestamp()) * 1000000.0); | 211 (TimeTicks::Now() - event.timestamp()).InMicroseconds(); |
| 212 if (event.cancelable()) { | 212 if (event.cancelable()) { |
| 213 if (m_frame->document()->isLoadCompleted()) { | 213 if (m_frame->document()->isLoadCompleted()) { |
| 214 DEFINE_STATIC_LOCAL(EnumerationHistogram, | 214 DEFINE_STATIC_LOCAL(EnumerationHistogram, |
| 215 touchDispositionsAfterPageLoadHistogram, | 215 touchDispositionsAfterPageLoadHistogram, |
| 216 ("Event.Touch.TouchDispositionsAfterPageLoad", | 216 ("Event.Touch.TouchDispositionsAfterPageLoad", |
| 217 TouchEventDispatchResultTypeMax)); | 217 TouchEventDispatchResultTypeMax)); |
| 218 touchDispositionsAfterPageLoadHistogram.count( | 218 touchDispositionsAfterPageLoadHistogram.count( |
| 219 (domDispatchResult != DispatchEventResult::NotCanceled) | 219 (domDispatchResult != DispatchEventResult::NotCanceled) |
| 220 ? HandledTouches | 220 ? HandledTouches |
| 221 : UnhandledTouches); | 221 : UnhandledTouches); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } | 507 } |
| 508 | 508 |
| 509 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); | 509 return dispatchTouchEvents(event, touchInfos, allTouchesReleased); |
| 510 } | 510 } |
| 511 | 511 |
| 512 bool TouchEventManager::isAnyTouchActive() const { | 512 bool TouchEventManager::isAnyTouchActive() const { |
| 513 return m_touchPressed; | 513 return m_touchPressed; |
| 514 } | 514 } |
| 515 | 515 |
| 516 } // namespace blink | 516 } // namespace blink |
| OLD | NEW |