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

Side by Side Diff: third_party/WebKit/Source/core/events/EventTarget.cpp

Issue 2160353002: Added UseCounters for touchstart, mousedown, pointerdown invocation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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 | third_party/WebKit/Source/core/frame/UseCounter.h » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
(...skipping 21 matching lines...) Expand all
32 #include "core/events/EventTarget.h" 32 #include "core/events/EventTarget.h"
33 33
34 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
35 #include "bindings/core/v8/ScriptEventListener.h" 35 #include "bindings/core/v8/ScriptEventListener.h"
36 #include "bindings/core/v8/SourceLocation.h" 36 #include "bindings/core/v8/SourceLocation.h"
37 #include "bindings/core/v8/V8DOMActivityLogger.h" 37 #include "bindings/core/v8/V8DOMActivityLogger.h"
38 #include "core/dom/ExceptionCode.h" 38 #include "core/dom/ExceptionCode.h"
39 #include "core/editing/Editor.h" 39 #include "core/editing/Editor.h"
40 #include "core/events/Event.h" 40 #include "core/events/Event.h"
41 #include "core/events/EventUtil.h" 41 #include "core/events/EventUtil.h"
42 #include "core/events/PointerEvent.h"
42 #include "core/frame/FrameHost.h" 43 #include "core/frame/FrameHost.h"
43 #include "core/frame/LocalDOMWindow.h" 44 #include "core/frame/LocalDOMWindow.h"
44 #include "core/frame/Settings.h" 45 #include "core/frame/Settings.h"
45 #include "core/frame/UseCounter.h" 46 #include "core/frame/UseCounter.h"
46 #include "core/inspector/ConsoleMessage.h" 47 #include "core/inspector/ConsoleMessage.h"
47 #include "core/inspector/InspectorInstrumentation.h" 48 #include "core/inspector/InspectorInstrumentation.h"
48 #include "platform/EventDispatchForbiddenScope.h" 49 #include "platform/EventDispatchForbiddenScope.h"
49 #include "platform/Histogram.h" 50 #include "platform/Histogram.h"
50 #include "wtf/PtrUtil.h" 51 #include "wtf/PtrUtil.h"
51 #include "wtf/StdLibExtras.h" 52 #include "wtf/StdLibExtras.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 return dispatchEventResult(*event); 541 return dispatchEventResult(*event);
541 } 542 }
542 543
543 bool EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList enerVector& entry) 544 bool EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList enerVector& entry)
544 { 545 {
545 // Fire all listeners registered for this event. Don't fire listeners remove d 546 // Fire all listeners registered for this event. Don't fire listeners remove d
546 // during event dispatch. Also, don't fire event listeners added during even t 547 // during event dispatch. Also, don't fire event listeners added during even t
547 // dispatch. Conveniently, all new event listeners will be added after or at 548 // dispatch. Conveniently, all new event listeners will be added after or at
548 // index |size|, so iterating up to (but not including) |size| naturally exc ludes 549 // index |size|, so iterating up to (but not including) |size| naturally exc ludes
549 // new event listeners. 550 // new event listeners.
551 //
552 // TODO(mustaq): This code needs to be refactored, crbug.com/629601
550 553
551 if (event->type() == EventTypeNames::beforeunload) { 554 if (event->type() == EventTypeNames::beforeunload) {
552 if (LocalDOMWindow* executingWindow = this->executingWindow()) { 555 if (LocalDOMWindow* executingWindow = this->executingWindow()) {
553 if (executingWindow->top()) 556 if (executingWindow->top())
554 UseCounter::count(executingWindow->document(), UseCounter::SubFr ameBeforeUnloadFired); 557 UseCounter::count(executingWindow->document(), UseCounter::SubFr ameBeforeUnloadFired);
555 UseCounter::count(executingWindow->document(), UseCounter::DocumentB eforeUnloadFired); 558 UseCounter::count(executingWindow->document(), UseCounter::DocumentB eforeUnloadFired);
556 } 559 }
557 } else if (event->type() == EventTypeNames::unload) { 560 } else if (event->type() == EventTypeNames::unload) {
558 if (LocalDOMWindow* executingWindow = this->executingWindow()) 561 if (LocalDOMWindow* executingWindow = this->executingWindow())
559 UseCounter::count(executingWindow->document(), UseCounter::DocumentU nloadFired); 562 UseCounter::count(executingWindow->document(), UseCounter::DocumentU nloadFired);
560 } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == E ventTypeNames::DOMFocusOut) { 563 } else if (event->type() == EventTypeNames::DOMFocusIn || event->type() == E ventTypeNames::DOMFocusOut) {
561 if (LocalDOMWindow* executingWindow = this->executingWindow()) 564 if (LocalDOMWindow* executingWindow = this->executingWindow())
562 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI nOutEvent); 565 UseCounter::count(executingWindow->document(), UseCounter::DOMFocusI nOutEvent);
563 } else if (event->type() == EventTypeNames::focusin || event->type() == Even tTypeNames::focusout) { 566 } else if (event->type() == EventTypeNames::focusin || event->type() == Even tTypeNames::focusout) {
564 if (LocalDOMWindow* executingWindow = this->executingWindow()) 567 if (LocalDOMWindow* executingWindow = this->executingWindow())
565 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu tEvent); 568 UseCounter::count(executingWindow->document(), UseCounter::FocusInOu tEvent);
566 } else if (event->type() == EventTypeNames::textInput) { 569 } else if (event->type() == EventTypeNames::textInput) {
567 if (LocalDOMWindow* executingWindow = this->executingWindow()) 570 if (LocalDOMWindow* executingWindow = this->executingWindow())
568 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired); 571 UseCounter::count(executingWindow->document(), UseCounter::TextInput Fired);
572 } else if (event->type() == EventTypeNames::touchstart) {
573 if (LocalDOMWindow* executingWindow = this->executingWindow())
574 UseCounter::count(executingWindow->document(), UseCounter::TouchStar tFired);
575 } else if (event->type() == EventTypeNames::mousedown) {
576 if (LocalDOMWindow* executingWindow = this->executingWindow())
577 UseCounter::count(executingWindow->document(), UseCounter::MouseDown Fired);
578 } else if (event->type() == EventTypeNames::pointerdown) {
579 if (LocalDOMWindow* executingWindow = this->executingWindow()) {
580 if (event->isPointerEvent() && static_cast<PointerEvent*>(event)->po interType() == "touch")
581 UseCounter::count(executingWindow->document(), UseCounter::Point erDownFiredForTouch);
582 UseCounter::count(executingWindow->document(), UseCounter::PointerDo wnFired);
583 }
569 } 584 }
570 585
571 ExecutionContext* context = getExecutionContext(); 586 ExecutionContext* context = getExecutionContext();
572 if (!context) 587 if (!context)
573 return false; 588 return false;
574 589
575 size_t i = 0; 590 size_t i = 0;
576 size_t size = entry.size(); 591 size_t size = entry.size();
577 if (!d->firingEventIterators) 592 if (!d->firingEventIterators)
578 d->firingEventIterators = wrapUnique(new FiringEventIteratorVector); 593 d->firingEventIterators = wrapUnique(new FiringEventIteratorVector);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // they have one less listener to invoke. 690 // they have one less listener to invoke.
676 if (d->firingEventIterators) { 691 if (d->firingEventIterators) {
677 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 692 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
678 d->firingEventIterators->at(i).iterator = 0; 693 d->firingEventIterators->at(i).iterator = 0;
679 d->firingEventIterators->at(i).end = 0; 694 d->firingEventIterators->at(i).end = 0;
680 } 695 }
681 } 696 }
682 } 697 }
683 698
684 } // namespace blink 699 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698