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

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

Issue 2205523004: Refactored UseCounter code for event-listener-firing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a TODO for the suspicious |if|. Created 4 years, 4 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/events/EventTarget.cpp » ('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, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 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 24 matching lines...) Expand all
35 #include "bindings/core/v8/AddEventListenerOptionsOrBoolean.h" 35 #include "bindings/core/v8/AddEventListenerOptionsOrBoolean.h"
36 #include "bindings/core/v8/EventListenerOptionsOrBoolean.h" 36 #include "bindings/core/v8/EventListenerOptionsOrBoolean.h"
37 #include "bindings/core/v8/ScriptWrappable.h" 37 #include "bindings/core/v8/ScriptWrappable.h"
38 #include "core/CoreExport.h" 38 #include "core/CoreExport.h"
39 #include "core/EventNames.h" 39 #include "core/EventNames.h"
40 #include "core/EventTargetNames.h" 40 #include "core/EventTargetNames.h"
41 #include "core/EventTypeNames.h" 41 #include "core/EventTypeNames.h"
42 #include "core/events/AddEventListenerOptionsResolved.h" 42 #include "core/events/AddEventListenerOptionsResolved.h"
43 #include "core/events/EventDispatchResult.h" 43 #include "core/events/EventDispatchResult.h"
44 #include "core/events/EventListenerMap.h" 44 #include "core/events/EventListenerMap.h"
45 #include "core/frame/UseCounter.h"
45 #include "platform/heap/Handle.h" 46 #include "platform/heap/Handle.h"
46 #include "wtf/Allocator.h" 47 #include "wtf/Allocator.h"
47 #include "wtf/text/AtomicString.h" 48 #include "wtf/text/AtomicString.h"
48 #include <memory> 49 #include <memory>
49 50
50 namespace blink { 51 namespace blink {
51 52
52 class DOMWindow; 53 class DOMWindow;
53 class Event; 54 class Event;
54 class LocalDOMWindow; 55 class LocalDOMWindow;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 virtual DispatchEventResult dispatchEventInternal(Event*); 170 virtual DispatchEventResult dispatchEventInternal(Event*);
170 171
171 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData. 172 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData.
172 virtual EventTargetData* eventTargetData() = 0; 173 virtual EventTargetData* eventTargetData() = 0;
173 virtual EventTargetData& ensureEventTargetData() = 0; 174 virtual EventTargetData& ensureEventTargetData() = 0;
174 175
175 private: 176 private:
176 LocalDOMWindow* executingWindow(); 177 LocalDOMWindow* executingWindow();
177 void setDefaultAddEventListenerOptions(const AtomicString& eventType, AddEve ntListenerOptionsResolved&); 178 void setDefaultAddEventListenerOptions(const AtomicString& eventType, AddEve ntListenerOptionsResolved&);
179
180 // UseCounts the event if it has the specified type. Returns true iff the ev ent type matches.
181 bool checkTypeThenUseCount(const Event*, const AtomicString&, const UseCount er::Feature);
182
178 bool fireEventListeners(Event*, EventTargetData*, EventListenerVector&); 183 bool fireEventListeners(Event*, EventTargetData*, EventListenerVector&);
179 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect or*, EventListenerVector*); 184 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect or*, EventListenerVector*);
180 185
181 bool clearAttributeEventListener(const AtomicString& eventType); 186 bool clearAttributeEventListener(const AtomicString& eventType);
182 187
183 friend class EventListenerIterator; 188 friend class EventListenerIterator;
184 }; 189 };
185 190
186 // EventTargetData is a GCed object, so it should not be used as a part of 191 // EventTargetData is a GCed object, so it should not be used as a part of
187 // object. However, we intentionally use it as a part of object for performance, 192 // object. However, we intentionally use it as a part of object for performance,
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 { 264 {
260 EventTargetData* d = eventTargetData(); 265 EventTargetData* d = eventTargetData();
261 if (!d) 266 if (!d)
262 return false; 267 return false;
263 return d->eventListenerMap.containsCapturing(eventType); 268 return d->eventListenerMap.containsCapturing(eventType);
264 } 269 }
265 270
266 } // namespace blink 271 } // namespace blink
267 272
268 #endif // EventTarget_h 273 #endif // EventTarget_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698