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

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

Issue 1876843002: Introduce few const getters for dom classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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, 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 virtual bool keepEventInNode(Event*) { return false; } 165 virtual bool keepEventInNode(Event*) { return false; }
166 166
167 protected: 167 protected:
168 EventTarget(); 168 EventTarget();
169 169
170 virtual bool addEventListenerInternal(const AtomicString& eventType, EventLi stener*, const EventListenerOptions&); 170 virtual bool addEventListenerInternal(const AtomicString& eventType, EventLi stener*, const EventListenerOptions&);
171 virtual bool removeEventListenerInternal(const AtomicString& eventType, Even tListener*, const EventListenerOptions&); 171 virtual bool removeEventListenerInternal(const AtomicString& eventType, Even tListener*, const EventListenerOptions&);
172 virtual DispatchEventResult dispatchEventInternal(Event*); 172 virtual DispatchEventResult dispatchEventInternal(Event*);
173 173
174 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData. 174 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData.
175 virtual EventTargetData* eventTargetData() = 0; 175 virtual EventTargetData* eventTargetData() const = 0;
176 virtual EventTargetData& ensureEventTargetData() = 0; 176 virtual EventTargetData& ensureEventTargetData() = 0;
177 177
178 private: 178 private:
179 #if !ENABLE(OILPAN) 179 #if !ENABLE(OILPAN)
180 // Subclasses should likely not override these themselves; instead, they sho uld use the REFCOUNTED_EVENT_TARGET() macro. 180 // Subclasses should likely not override these themselves; instead, they sho uld use the REFCOUNTED_EVENT_TARGET() macro.
181 virtual void refEventTarget() = 0; 181 virtual void refEventTarget() = 0;
182 virtual void derefEventTarget() = 0; 182 virtual void derefEventTarget() = 0;
183 #endif 183 #endif
184 184
185 LocalDOMWindow* executingWindow(); 185 LocalDOMWindow* executingWindow();
(...skipping 11 matching lines...) Expand all
197 // EventTargetWithInlineData::m_eventTargetData and store it to a Member etc. 197 // EventTargetWithInlineData::m_eventTargetData and store it to a Member etc.
198 class GC_PLUGIN_IGNORE("513199") CORE_EXPORT EventTargetWithInlineData : public EventTarget { 198 class GC_PLUGIN_IGNORE("513199") CORE_EXPORT EventTargetWithInlineData : public EventTarget {
199 public: 199 public:
200 DEFINE_INLINE_VIRTUAL_TRACE() 200 DEFINE_INLINE_VIRTUAL_TRACE()
201 { 201 {
202 visitor->trace(m_eventTargetData); 202 visitor->trace(m_eventTargetData);
203 EventTarget::trace(visitor); 203 EventTarget::trace(visitor);
204 } 204 }
205 205
206 protected: 206 protected:
207 EventTargetData* eventTargetData() final { return &m_eventTargetData; } 207 EventTargetData* eventTargetData() const final
208 {
209 return const_cast<EventTargetData*>(&m_eventTargetData);
210 }
211
208 EventTargetData& ensureEventTargetData() final { return m_eventTargetData; } 212 EventTargetData& ensureEventTargetData() final { return m_eventTargetData; }
209 213
210 private: 214 private:
211 EventTargetData m_eventTargetData; 215 EventTargetData m_eventTargetData;
212 }; 216 };
213 217
214 // Base class for classes that wish to inherit from RefCountedGarbageCollected ( in non-Oilpan world) and 218 // Base class for classes that wish to inherit from RefCountedGarbageCollected ( in non-Oilpan world) and
215 // EventTargetWithInlineData (in both worlds). For details about how to use this class template, see the comments for 219 // EventTargetWithInlineData (in both worlds). For details about how to use this class template, see the comments for
216 // EventTargetWithInlineData above. 220 // EventTargetWithInlineData above.
217 // 221 //
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 using baseClass::deref; \ 316 using baseClass::deref; \
313 private: \ 317 private: \
314 void refEventTarget() final { ref(); } \ 318 void refEventTarget() final { ref(); } \
315 void derefEventTarget() final { deref(); } \ 319 void derefEventTarget() final { deref(); } \
316 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro 320 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
317 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo unted<baseClass>) 321 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo unted<baseClass>)
318 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET _REFCOUNTING(RefCountedGarbageCollected<baseClass>) 322 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET _REFCOUNTING(RefCountedGarbageCollected<baseClass>)
319 #endif // ENABLE(OILPAN) 323 #endif // ENABLE(OILPAN)
320 324
321 #endif // EventTarget_h 325 #endif // EventTarget_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/EventListenerMap.cpp ('k') | third_party/WebKit/Source/core/html/ClassList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698