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

Unified Diff: Source/core/events/EventListenerMap.h

Issue 1238083002: Oilpan: Move the EventListener hierarchy to Oilpan's heap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/events/EventListenerMap.h
diff --git a/Source/core/events/EventListenerMap.h b/Source/core/events/EventListenerMap.h
index 78c46dfaa6b8da895344487cfeaa9f453c668b3b..9f8f3307efc818dd56ed2aa2018717270620a2ac 100644
--- a/Source/core/events/EventListenerMap.h
+++ b/Source/core/events/EventListenerMap.h
@@ -43,10 +43,11 @@ namespace blink {
class EventTarget;
-typedef Vector<RegisteredEventListener, 1> EventListenerVector;
+typedef WillBeHeapVector<RegisteredEventListener, 1> EventListenerVector;
class CORE_EXPORT EventListenerMap {
WTF_MAKE_NONCOPYABLE(EventListenerMap);
+ DISALLOW_ALLOCATION();
public:
EventListenerMap();
@@ -55,19 +56,21 @@ public:
bool containsCapturing(const AtomicString& eventType) const;
void clear();
- bool add(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ bool add(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, bool useCapture);
bool remove(const AtomicString& eventType, EventListener*, bool useCapture, size_t& indexOfRemovedListener);
EventListenerVector* find(const AtomicString& eventType);
Vector<AtomicString> eventTypes() const;
void copyEventListenersNotCreatedFromMarkupToTarget(EventTarget*);
+ DECLARE_TRACE();
+
private:
friend class EventListenerIterator;
void assertNoActiveIterators();
- Vector<std::pair<AtomicString, OwnPtr<EventListenerVector>>, 2> m_entries;
+ WillBeHeapVector<std::pair<AtomicString, OwnPtrWillBeMember<EventListenerVector>>, 2> m_entries;
#if ENABLE(ASSERT)
int m_activeIteratorCount;
@@ -76,8 +79,9 @@ private:
class EventListenerIterator {
WTF_MAKE_NONCOPYABLE(EventListenerIterator);
+ STACK_ALLOCATED();
public:
- EventListenerIterator(EventTarget*);
+ explicit EventListenerIterator(EventTarget*);
#if ENABLE(ASSERT)
~EventListenerIterator();
#endif
@@ -85,6 +89,8 @@ public:
EventListener* nextListener();
private:
+ // This cannot be a Member because it is pointing to a part of object.
+ // TODO(haraken): Use Member<EventTarget> instead of EventListenerMap*.
EventListenerMap* m_map;
unsigned m_entryIndex;
unsigned m_index;

Powered by Google App Engine
This is Rietveld 408576698