Implementors of memoryCost() need to be thread-safe.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jul 2017 19:16:54 +0000 (19:16 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jul 2017 19:16:54 +0000 (19:16 +0000)
commit1e61cd05438219d240410b6b4a7edc79ee0117d6
treec90871d168aa19108aae2c14df7d34fcae032632
parent4709451c377328c701a6c29b30d14416167963c7
Implementors of memoryCost() need to be thread-safe.
https://bugs.webkit.org/show_bug.cgi?id=172738
<rdar://problem/32474881>

Reviewed by Keith Miller.

No new tests. This patch fixes a race condition bug that can result in random
crashes (and other unpredictable behavior), and is very difficult to test for.

* Modules/webaudio/AudioBuffer.cpp:
(WebCore::AudioBuffer::releaseMemory):
(WebCore::AudioBuffer::memoryCost):
* Modules/webaudio/AudioBuffer.h:
* dom/ChildNodeList.h:
* dom/CollectionIndexCache.h:
(WebCore::CollectionIndexCache::memoryCost):
* dom/LiveNodeList.h:
* html/CachedHTMLCollection.h:
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::memoryCost):
(WebCore::HTMLCanvasElement::externalMemoryCost):
(WebCore::HTMLCanvasElement::setImageBuffer):
* html/HTMLCanvasElement.h:
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::invalidateNamedElementCache):
* html/HTMLCollection.h:
(WebCore::CollectionNamedElementCache::memoryCost):
(WebCore::HTMLCollection::memoryCost):
(WebCore::HTMLCollection::setNamedItemCache):
* platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::memoryCost):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::memoryCost):
(WebCore::ImageBuffer::externalMemoryCost):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219460 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioBuffer.cpp
Source/WebCore/Modules/webaudio/AudioBuffer.h
Source/WebCore/dom/ChildNodeList.h
Source/WebCore/dom/CollectionIndexCache.h
Source/WebCore/dom/LiveNodeList.h
Source/WebCore/html/CachedHTMLCollection.h
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLCanvasElement.h
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLCollection.h
Source/WebCore/platform/graphics/ImageBuffer.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp