Don't use DEPRECATED_DEFINE_STATIC_LOCAL for mutexes
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Sep 2014 22:56:48 +0000 (22:56 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Sep 2014 22:56:48 +0000 (22:56 +0000)
commita4d2da91ebf5ee0eae8db41b5ec4035930efe846
tree7ec137bcb44392d40f984ed6e68335bd1794240d
parent4c07d86dc7e199bad5312457aa8aaa476908cf87
Don't use DEPRECATED_DEFINE_STATIC_LOCAL for mutexes
https://bugs.webkit.org/show_bug.cgi?id=136510

Reviewed by Andreas Kling.

Mutexes are intended to be used from multiple threads, and DEPRECATED_DEFINE_STATIC_LOCAL is not thread safe.

* bindings/objc/DOMInternal.mm:
(wrapperCacheLock):
(getDOMWrapper):
(addDOMWrapper):
(removeDOMWrapper):
Use LazyNeverDestroyed + std::call_once, and switch the mutex over to an std::mutex.

* dom/EventListenerMap.cpp:
(WebCore::EventListenerMap::assertNoActiveIterators):
(WebCore::EventListenerIterator::EventListenerIterator):
(WebCore::EventListenerIterator::~EventListenerIterator):
(WebCore::activeIteratorCountMutex):
(WebCore::EventListenerMap::EventListenerMap): Deleted.
* dom/EventListenerMap.h:
Use an std::atomic<int> instead of a mutex here.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173240 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/bindings/objc/DOMInternal.mm
Source/WebCore/dom/EventListenerMap.cpp
Source/WebCore/dom/EventListenerMap.h