Chromium Code Reviews| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 EventTarget* touchEventTarget = eventTarget; | 185 EventTarget* touchEventTarget = eventTarget; |
| 186 TouchEvent* touchEvent = TouchEvent::create( | 186 TouchEvent* touchEvent = TouchEvent::create( |
| 187 touches, touchesByTarget.get(touchEventTarget), changedTouches[s tate].m_touches.get(), | 187 touches, touchesByTarget.get(touchEventTarget), changedTouches[s tate].m_touches.get(), |
| 188 eventName, touchEventTarget->toNode()->document().domWindow(), | 188 eventName, touchEventTarget->toNode()->document().domWindow(), |
| 189 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), touchStartOrFirstTouchMove, event.timestamp()); | 189 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), touchStartOrFirstTouchMove, event.timestamp()); |
| 190 | 190 |
| 191 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent); | 191 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent); |
| 192 | 192 |
| 193 // Only report for top level documents with a single touch on | 193 // Only report for top level documents with a single touch on |
| 194 // touch-start or the first touch-move. | 194 // touch-start or the first touch-move. |
| 195 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca ncelable() && m_frame->isMainFrame()) { | 195 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && m_frame- >isMainFrame()) { |
| 196 | 196 |
| 197 // Record the disposition and latency of touch starts and first touch moves before and after the page is fully loaded respectively. | 197 // Record the disposition and latency of touch starts and first touch moves before and after the page is fully loaded respectively. |
| 198 int64_t latencyInMicros = static_cast<int64_t>((monotonicallyInc reasingTime() - event.timestamp()) * 1000000.0); | 198 int64_t latencyInMicros = static_cast<int64_t>((monotonicallyInc reasingTime() - event.timestamp()) * 1000000.0); |
| 199 if (m_frame->document()->isLoadCompleted()) { | 199 if (event.cancelable()) { |
| 200 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsA fterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchEvent DispatchResultTypeMax)); | 200 if (m_frame->document()->isLoadCompleted()) { |
| 201 touchDispositionsAfterPageLoadHistogram.count((domDispatchRe sult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); | 201 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsAfterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchE ventDispatchResultTypeMax)); |
| 202 touchDispositionsAfterPageLoadHistogram.count((domDispat chResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouche s); | |
| 202 | 203 |
| 203 DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyAfterP ageLoadHistogram, ("Event.Touch.TouchLatencyAfterPageLoad", 1, 100000000, 50)); | 204 DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyAf terPageLoadHistogram, ("Event.Touch.TouchLatencyAfterPageLoad", 1, 100000000, 50 )); |
| 204 eventLatencyAfterPageLoadHistogram.count(latencyInMicros); | 205 eventLatencyAfterPageLoadHistogram.count(latencyInMicros ); |
| 205 } else { | 206 } else { |
| 206 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsB eforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", TouchEve ntDispatchResultTypeMax)); | 207 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsBeforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", Touc hEventDispatchResultTypeMax)); |
| 207 touchDispositionsBeforePageLoadHistogram.count((domDispatchR esult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches); | 208 touchDispositionsBeforePageLoadHistogram.count((domDispa tchResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouch es); |
| 208 | 209 |
| 209 DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyBefore PageLoadHistogram, ("Event.Touch.TouchLatencyBeforePageLoad", 1, 100000000, 50)) ; | 210 DEFINE_STATIC_LOCAL(CustomCountHistogram, eventLatencyBe forePageLoadHistogram, ("Event.Touch.TouchLatencyBeforePageLoad", 1, 100000000, 50)); |
| 210 eventLatencyBeforePageLoadHistogram.count(latencyInMicros); | 211 eventLatencyBeforePageLoadHistogram.count(latencyInMicro s); |
| 212 } | |
| 211 } | 213 } |
| 212 | 214 |
| 213 // Report the touch disposition, split by whether there is an ac tive fling animation. | 215 // Report the touch disposition, split by whether there is an ac tive fling animation. |
| 214 if (event.type() == PlatformEvent::TouchStart) { | 216 if (event.dispatchedDuringFling()) { |
| 215 if (event.dispatchedDuringFling()) { | 217 if (event.dispatchType() == PlatformEvent::ListenersForcedNo nBlockingPassiveDueToFling) { |
| 216 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsDuringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling", TouchEvent DispatchResultTypeMax)); | 218 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsDuringFlingHistogram, ("Event.Touch.TouchDispositionsDuringFling2", TouchEven tDispatchResultTypeMax)); |
|
dtapuska
2016/08/10 14:47:42
if it is forced to be non blocking then it will al
| |
| 217 touchDispositionsDuringFlingHistogram.count((domDispatch Result != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches) ; | 219 touchDispositionsDuringFlingHistogram.count((domDispatch Result != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches) ; |
| 218 } else { | 220 } |
| 219 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsOutsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling", TouchEve ntDispatchResultTypeMax)); | 221 } else { |
| 222 if (event.cancelable()) { | |
| 223 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositi onsOutsideFlingHistogram, ("Event.Touch.TouchDispositionsOutsideFling2", TouchEv entDispatchResultTypeMax)); | |
| 220 touchDispositionsOutsideFlingHistogram.count((domDispatc hResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches ); | 224 touchDispositionsOutsideFlingHistogram.count((domDispatc hResult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches ); |
| 221 } | 225 } |
| 222 } | 226 } |
| 223 } | 227 } |
| 224 eventResult = EventHandler::mergeEventResult(eventResult, | 228 eventResult = EventHandler::mergeEventResult(eventResult, |
| 225 EventHandler::toWebInputEventResult(domDispatchResult)); | 229 EventHandler::toWebInputEventResult(domDispatchResult)); |
| 226 } | 230 } |
| 227 } | 231 } |
| 228 | 232 |
| 229 if (allTouchesReleased) | 233 if (allTouchesReleased) |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; | 537 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; |
| 534 break; | 538 break; |
| 535 default: | 539 default: |
| 536 NOTREACHED(); | 540 NOTREACHED(); |
| 537 return; | 541 return; |
| 538 } | 542 } |
| 539 Deprecation::countDeprecation(m_frame, feature); | 543 Deprecation::countDeprecation(m_frame, feature); |
| 540 } | 544 } |
| 541 | 545 |
| 542 } // namespace blink | 546 } // namespace blink |
| OLD | NEW |