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

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

Issue 1934413003: Usecounter added for counting usage of addEventListener for PointerEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
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 18 matching lines...) Expand all
29 * 29 *
30 */ 30 */
31 31
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/V8DOMActivityLogger.h" 35 #include "bindings/core/v8/V8DOMActivityLogger.h"
36 #include "core/dom/ExceptionCode.h" 36 #include "core/dom/ExceptionCode.h"
37 #include "core/editing/Editor.h" 37 #include "core/editing/Editor.h"
38 #include "core/events/Event.h" 38 #include "core/events/Event.h"
39 #include "core/events/EventUtil.h"
39 #include "core/inspector/InspectorInstrumentation.h" 40 #include "core/inspector/InspectorInstrumentation.h"
40 #include "core/frame/LocalDOMWindow.h" 41 #include "core/frame/LocalDOMWindow.h"
41 #include "core/frame/UseCounter.h" 42 #include "core/frame/UseCounter.h"
42 #include "platform/EventDispatchForbiddenScope.h" 43 #include "platform/EventDispatchForbiddenScope.h"
43 #include "wtf/StdLibExtras.h" 44 #include "wtf/StdLibExtras.h"
44 #include "wtf/Threading.h" 45 #include "wtf/Threading.h"
45 #include "wtf/Vector.h" 46 #include "wtf/Vector.h"
46 47
47 using namespace WTF; 48 using namespace WTF;
48 49
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 { 146 {
146 setDefaultEventListenerOptions(options); 147 setDefaultEventListenerOptions(options);
147 return addEventListenerInternal(eventType, listener, options); 148 return addEventListenerInternal(eventType, listener, options);
148 } 149 }
149 150
150 bool EventTarget::addEventListenerInternal(const AtomicString& eventType, EventL istener* listener, const EventListenerOptions& options) 151 bool EventTarget::addEventListenerInternal(const AtomicString& eventType, EventL istener* listener, const EventListenerOptions& options)
151 { 152 {
152 if (!listener) 153 if (!listener)
153 return false; 154 return false;
154 155
156 if (EventUtil::isPointerEventType(eventType)) {
bokan 2016/05/10 22:52:01 Put this in the addedEventListener method below.
sahel 2016/05/11 21:15:02 Done.
157 if (LocalDOMWindow* executingWindow = this->executingWindow()) {
158 UseCounter::count(executingWindow->document(), UseCounter::PointerEv entAddListenerCount);
159 }
160 }
155 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo ggerIfIsolatedWorld(); 161 V8DOMActivityLogger* activityLogger = V8DOMActivityLogger::currentActivityLo ggerIfIsolatedWorld();
156 if (activityLogger) { 162 if (activityLogger) {
157 Vector<String> argv; 163 Vector<String> argv;
158 argv.append(toNode() ? toNode()->nodeName() : interfaceName()); 164 argv.append(toNode() ? toNode()->nodeName() : interfaceName());
159 argv.append(eventType); 165 argv.append(eventType);
160 activityLogger->logEvent("blinkAddEventListener", argv.size(), argv.data ()); 166 activityLogger->logEvent("blinkAddEventListener", argv.size(), argv.data ());
161 } 167 }
162 168
163 RegisteredEventListener registeredListener; 169 RegisteredEventListener registeredListener;
164 bool added = ensureEventTargetData().eventListenerMap.add(eventType, listene r, options, &registeredListener); 170 bool added = ensureEventTargetData().eventListenerMap.add(eventType, listene r, options, &registeredListener);
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // they have one less listener to invoke. 510 // they have one less listener to invoke.
505 if (d->firingEventIterators) { 511 if (d->firingEventIterators) {
506 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) { 512 for (size_t i = 0; i < d->firingEventIterators->size(); ++i) {
507 d->firingEventIterators->at(i).iterator = 0; 513 d->firingEventIterators->at(i).iterator = 0;
508 d->firingEventIterators->at(i).end = 0; 514 d->firingEventIterators->at(i).end = 0;
509 } 515 }
510 } 516 }
511 } 517 }
512 518
513 } // namespace blink 519 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698