summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp b/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp
index 82ea3fa..d2bd8a0 100644
--- a/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp
@@ -102,12 +102,20 @@ void ImagesManager::releaseImage(unsigned imgCRC)
android::Mutex::Autolock lock(m_imagesLock);
if (m_images.contains(imgCRC)) {
ImageTexture* image = m_images.get(imgCRC);
- if (image->getRefCnt() == 1)
- m_images.remove(imgCRC);
+ // don't need to remove image from the HashMap, it will unregister
+ // itself by calling onImageTextureDestroy().
+
SkSafeUnref(image);
}
}
+void ImagesManager::onImageTextureDestroy(unsigned imgCRC)
+{
+ // NOTE: all unrefs must go through releaseImage, to ensure that
+ // onImageTextureDestroy is called under the m_imagesLock
+ m_images.remove(imgCRC);
+}
+
int ImagesManager::nbTextures()
{
android::Mutex::Autolock lock(m_imagesLock);