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

Unified Diff: Source/core/events/EventTarget.cpp

Issue 794223003: Cheaper thread-safe atomic initialization of static references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add type check for initial value Created 5 years, 11 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/EventTarget.cpp
diff --git a/Source/core/events/EventTarget.cpp b/Source/core/events/EventTarget.cpp
index 36857b1c455c6793901e4726c9d0823de60b71d1..b3b1d6ba7b234c825f68657529b92062a8a4c0b4 100644
--- a/Source/core/events/EventTarget.cpp
+++ b/Source/core/events/EventTarget.cpp
@@ -381,15 +381,15 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList
const EventListenerVector& EventTarget::getEventListeners(const AtomicString& eventType)
{
- AtomicallyInitializedStatic(EventListenerVector*, emptyVector = new EventListenerVector);
+ AtomicallyInitializedStaticReference(EventListenerVector, emptyVector, new EventListenerVector);
EventTargetData* d = eventTargetData();
if (!d)
- return *emptyVector;
+ return emptyVector;
EventListenerVector* listenerVector = d->eventListenerMap.find(eventType);
if (!listenerVector)
- return *emptyVector;
+ return emptyVector;
return *listenerVector;
}

Powered by Google App Engine
This is Rietveld 408576698