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

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

Issue 2123043002: Add a comment why we use HeapVector for a map in EventListenerMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/EventListenerMap.h
diff --git a/third_party/WebKit/Source/core/events/EventListenerMap.h b/third_party/WebKit/Source/core/events/EventListenerMap.h
index 37851fc0c22a5493dbc1f3c207ba989fa73c8510..77c61a5f05b8d8cf287663077edb914e31fda9cf 100644
--- a/third_party/WebKit/Source/core/events/EventListenerMap.h
+++ b/third_party/WebKit/Source/core/events/EventListenerMap.h
@@ -71,6 +71,10 @@ private:
void assertNoActiveIterators();
+ // We use HeapVector instead of HeapHashMap because
+ // - HeapVector is much more space efficient than HeapHashMap.
+ // - An EventTarget rarely has event listeners for many event types, and
+ // HeapVector is faster in such cases.
HeapVector<std::pair<AtomicString, Member<EventListenerVector>>, 2> m_entries;
#if ENABLE(ASSERT)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698