Commit d2e963e0 authored by esprehn@chromium.org's avatar esprehn@chromium.org

Add TRACE_EVENT for common events in EventHandler

Often in traces it's hard to know what events are being hanled and how
much time is spent where in the EventDispatcher and EventHandler. This
patch adds a bunch of new TRACE_EVENT's to make it easier.

Review URL: https://codereview.chromium.org/210823007

git-svn-id: svn://svn.chromium.org/blink/trunk@170011 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c8e4cf37
...@@ -41,6 +41,7 @@ static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0; ...@@ -41,6 +41,7 @@ static HashSet<Node*>* gNodesDispatchingSimulatedClicks = 0;
bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator) bool EventDispatcher::dispatchEvent(Node* node, PassRefPtr<EventDispatchMediator> mediator)
{ {
TRACE_EVENT0("webkit", "EventDispatcher::dispatchEvent");
ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
if (!mediator->event()) if (!mediator->event())
return true; return true;
...@@ -99,6 +100,8 @@ void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent, ...@@ -99,6 +100,8 @@ void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent,
bool EventDispatcher::dispatch() bool EventDispatcher::dispatch()
{ {
TRACE_EVENT0("webkit", "EventDispatcher::dispatch");
#ifndef NDEBUG #ifndef NDEBUG
ASSERT(!m_eventDispatched); ASSERT(!m_eventDispatched);
m_eventDispatched = true; m_eventDispatched = true;
......
...@@ -502,6 +502,8 @@ void EventHandler::selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHit ...@@ -502,6 +502,8 @@ void EventHandler::selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHit
bool EventHandler::handleMousePressEventDoubleClick(const MouseEventWithHitTestResults& event) bool EventHandler::handleMousePressEventDoubleClick(const MouseEventWithHitTestResults& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMousePressEventDoubleClick");
if (event.event().button() != LeftButton) if (event.event().button() != LeftButton)
return false; return false;
...@@ -520,6 +522,8 @@ bool EventHandler::handleMousePressEventDoubleClick(const MouseEventWithHitTestR ...@@ -520,6 +522,8 @@ bool EventHandler::handleMousePressEventDoubleClick(const MouseEventWithHitTestR
bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestResults& event) bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestResults& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMousePressEventTripleClick");
if (event.event().button() != LeftButton) if (event.event().button() != LeftButton)
return false; return false;
...@@ -545,6 +549,8 @@ static int textDistance(const Position& start, const Position& end) ...@@ -545,6 +549,8 @@ static int textDistance(const Position& start, const Position& end)
bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestResults& event) bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestResults& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMousePressEventSingleClick");
m_frame->document()->updateLayoutIgnorePendingStylesheets(); m_frame->document()->updateLayoutIgnorePendingStylesheets();
Node* innerNode = event.targetNode(); Node* innerNode = event.targetNode();
if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect)) if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect))
...@@ -621,6 +627,8 @@ static inline bool canMouseDownStartSelect(Node* node) ...@@ -621,6 +627,8 @@ static inline bool canMouseDownStartSelect(Node* node)
bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& event) bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMousePressEvent");
// Reset drag state. // Reset drag state.
dragState().m_dragSrc = nullptr; dragState().m_dragSrc = nullptr;
...@@ -686,6 +694,8 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve ...@@ -686,6 +694,8 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event) bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMouseDraggedEvent");
if (!m_mousePressed) if (!m_mousePressed)
return false; return false;
...@@ -885,6 +895,8 @@ bool EventHandler::panScrollInProgress() const ...@@ -885,6 +895,8 @@ bool EventHandler::panScrollInProgress() const
HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding) HitTestResult EventHandler::hitTestResultAtPoint(const LayoutPoint& point, HitTestRequest::HitTestRequestType hitType, const LayoutSize& padding)
{ {
TRACE_EVENT0("webkit", "EventHandler::hitTestResultAtPoint");
// We always send hitTestResultAtPoint to the main frame if we have one, // We always send hitTestResultAtPoint to the main frame if we have one,
// otherwise we might hit areas that are obscured by higher frames. // otherwise we might hit areas that are obscured by higher frames.
if (Page* page = m_frame->page()) { if (Page* page = m_frame->page()) {
...@@ -1285,6 +1297,8 @@ static LayoutPoint documentPointForWindowPoint(LocalFrame* frame, const IntPoint ...@@ -1285,6 +1297,8 @@ static LayoutPoint documentPointForWindowPoint(LocalFrame* frame, const IntPoint
bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMousePressEvent");
RefPtr<FrameView> protector(m_frame->view()); RefPtr<FrameView> protector(m_frame->view());
bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent); bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent);
...@@ -1446,6 +1460,8 @@ ScrollableArea* EventHandler::associatedScrollableArea(const RenderLayer* layer) ...@@ -1446,6 +1460,8 @@ ScrollableArea* EventHandler::associatedScrollableArea(const RenderLayer* layer)
bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event) bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMouseMoveEvent");
RefPtr<FrameView> protector(m_frame->view()); RefPtr<FrameView> protector(m_frame->view());
MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration); MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration);
...@@ -1473,6 +1489,8 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event) ...@@ -1473,6 +1489,8 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& event)
void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event) void EventHandler::handleMouseLeaveEvent(const PlatformMouseEvent& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMouseLeaveEvent");
RefPtr<FrameView> protector(m_frame->view()); RefPtr<FrameView> protector(m_frame->view());
handleMouseMoveOrLeaveEvent(event); handleMouseMoveOrLeaveEvent(event);
} }
...@@ -1611,6 +1629,8 @@ static Node* parentForClickEvent(const Node& node) ...@@ -1611,6 +1629,8 @@ static Node* parentForClickEvent(const Node& node)
bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleMouseReleaseEvent");
RefPtr<FrameView> protector(m_frame->view()); RefPtr<FrameView> protector(m_frame->view());
m_frame->selection().setCaretBlinkingSuspended(false); m_frame->selection().setCaretBlinkingSuspended(false);
...@@ -3577,6 +3597,8 @@ HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout ...@@ -3577,6 +3597,8 @@ HitTestResult EventHandler::hitTestResultInFrame(LocalFrame* frame, const Layout
bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
{ {
TRACE_EVENT0("webkit", "EventHandler::handleTouchEvent");
// First build up the lists to use for the 'touches', 'targetTouches' and 'changedTouches' attributes // First build up the lists to use for the 'touches', 'targetTouches' and 'changedTouches' attributes
// in the JS event. See http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/ // in the JS event. See http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/
// for an overview of how these lists fit together. // for an overview of how these lists fit together.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment