Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1924083004: Add UMA metric for tracking listeners for blocking touch before page finished loading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 FrameView* view = document->view(); 207 FrameView* view = document->view();
208 if (view && view->isScrollable()) 208 if (view && view->isScrollable())
209 result += kTouchTargetHistogramScrollableDocumentOffset; 209 result += kTouchTargetHistogramScrollableDocumentOffset;
210 } 210 }
211 211
212 if (dispatchResult != DispatchEventResult::NotCanceled) 212 if (dispatchResult != DispatchEventResult::NotCanceled)
213 result += kTouchTargetHistogramHandledOffset; 213 result += kTouchTargetHistogramHandledOffset;
214 return static_cast<TouchTargetAndDispatchResultType>(result); 214 return static_cast<TouchTargetAndDispatchResultType>(result);
215 } 215 }
216 216
217 enum TouchEventDispatchResultType {
218 UnhandledTouches, // Unhandled touch events.
219 HandledTouches, // Handled touch events.
220 TouchEventDispatchResultTypeMax,
221 };
222
217 } // namespace 223 } // namespace
218 224
219 using namespace HTMLNames; 225 using namespace HTMLNames;
220 226
221 // The link drag hysteresis is much larger than the others because there 227 // The link drag hysteresis is much larger than the others because there
222 // needs to be enough space to cancel the link press without starting a link dra g, 228 // needs to be enough space to cancel the link press without starting a link dra g,
223 // and because dragging links is rare. 229 // and because dragging links is rare.
224 static const int LinkDragHysteresis = 40; 230 static const int LinkDragHysteresis = 40;
225 static const int ImageDragHysteresis = 5; 231 static const int ImageDragHysteresis = 5;
226 static const int TextDragHysteresis = 3; 232 static const int TextDragHysteresis = 3;
(...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after
3788 eventName, touchEventTarget->toNode()->document().domWindow(), 3794 eventName, touchEventTarget->toNode()->document().domWindow(),
3789 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp()); 3795 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp());
3790 3796
3791 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent); 3797 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent);
3792 3798
3793 // Only report for top level documents with a single touch on 3799 // Only report for top level documents with a single touch on
3794 // touch-start or the first touch-move. 3800 // touch-start or the first touch-move.
3795 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca ncelable() && !m_frame->document()->ownerElement()) { 3801 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca ncelable() && !m_frame->document()->ownerElement()) {
3796 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp eMax)); 3802 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp eMax));
3797 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue( eventTarget, domDispatchResult)); 3803 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue( eventTarget, domDispatchResult));
3804
3805 // Count the handled touch starts and first touch moves before a nd after the page is fully loaded respectively.
3806 if (m_frame->document()->isLoadCompleted()) {
3807 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsA fterPageLoadHistogram, ("Event.Touch.TouchDispositionsAfterPageLoad", TouchEvent DispatchResultTypeMax));
3808 touchDispositionsAfterPageLoadHistogram.count((domDispatchRe sult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches);
3809 } else {
3810 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchDispositionsB eforePageLoadHistogram, ("Event.Touch.TouchDispositionsBeforePageLoad", TouchEve ntDispatchResultTypeMax));
3811 touchDispositionsBeforePageLoadHistogram.count((domDispatchR esult != DispatchEventResult::NotCanceled) ? HandledTouches : UnhandledTouches);
3812 }
3798 } 3813 }
3799 eventResult = mergeEventResult(eventResult, toWebInputEventResult(do mDispatchResult)); 3814 eventResult = mergeEventResult(eventResult, toWebInputEventResult(do mDispatchResult));
3800 } 3815 }
3801 } 3816 }
3802
3803 return eventResult; 3817 return eventResult;
3804 } 3818 }
3805 3819
3806 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt) 3820 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt)
3807 { 3821 {
3808 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); 3822 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent");
3809 3823
3810 const Vector<PlatformTouchPoint>& points = event.touchPoints(); 3824 const Vector<PlatformTouchPoint>& points = event.touchPoints();
3811 3825
3812 bool freshTouchEvents = true; 3826 bool freshTouchEvents = true;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
4081 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4095 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4082 { 4096 {
4083 #if OS(MACOSX) 4097 #if OS(MACOSX)
4084 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4098 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4085 #else 4099 #else
4086 return PlatformEvent::AltKey; 4100 return PlatformEvent::AltKey;
4087 #endif 4101 #endif
4088 } 4102 }
4089 4103
4090 } // namespace blink 4104 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698