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

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

Issue 656653003: Replace function static vector with atomically initialized vector (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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: Source/core/events/EventTarget.cpp
diff --git a/Source/core/events/EventTarget.cpp b/Source/core/events/EventTarget.cpp
index 5dede6f454943b4f267b852e70f1fb4202c21e12..fefdecf4274f325e746f302f0015c652280719f8 100644
--- a/Source/core/events/EventTarget.cpp
+++ b/Source/core/events/EventTarget.cpp
@@ -43,6 +43,7 @@
#include "platform/EventDispatchForbiddenScope.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "wtf/StdLibExtras.h"
+#include "wtf/Threading.h"
#include "wtf/Vector.h"
using namespace WTF;
@@ -356,15 +357,15 @@ void EventTarget::fireEventListeners(Event* event, EventTargetData* d, EventList
const EventListenerVector& EventTarget::getEventListeners(const AtomicString& eventType)
{
- DEFINE_STATIC_LOCAL(EventListenerVector, emptyVector, ());
+ AtomicallyInitializedStatic(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;
}
« 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