summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp')
-rw-r--r--chromium/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/chromium/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp b/chromium/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
index 5e7bb4d43af..3d5e9dd65e2 100644
--- a/chromium/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
+++ b/chromium/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.cpp
@@ -27,6 +27,7 @@
#include "platform/graphics/ImageDecodingStore.h"
#include "platform/TraceEvent.h"
+#include "wtf/Threading.h"
namespace WebCore {
@@ -37,15 +38,8 @@ namespace {
// with a lot of (very) large images.
static const size_t maxTotalSizeOfDiscardableEntries = 256 * 1024 * 1024;
static const size_t defaultMaxTotalSizeOfHeapEntries = 32 * 1024 * 1024;
-static ImageDecodingStore* s_instance = 0;
static bool s_imageCachingEnabled = true;
-static void setInstance(ImageDecodingStore* imageDecodingStore)
-{
- delete s_instance;
- s_instance = imageDecodingStore;
-}
-
} // namespace
ImageDecodingStore::ImageDecodingStore()
@@ -69,17 +63,8 @@ ImageDecodingStore::~ImageDecodingStore()
ImageDecodingStore* ImageDecodingStore::instance()
{
- return s_instance;
-}
-
-void ImageDecodingStore::initializeOnce()
-{
- setInstance(ImageDecodingStore::create().leakPtr());
-}
-
-void ImageDecodingStore::shutdown()
-{
- setInstance(0);
+ AtomicallyInitializedStatic(ImageDecodingStore*, store = ImageDecodingStore::create().leakPtr());
+ return store;
}
void ImageDecodingStore::setImageCachingEnabled(bool enabled)
@@ -367,7 +352,7 @@ void ImageDecodingStore::insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheM
typename U::KeyType key = cacheEntry->cacheKey();
typename V::AddResult result = identifierMap->add(cacheEntry->generator(), typename V::MappedType());
- result.iterator->value.add(key);
+ result.storedValue->value.add(key);
cacheMap->add(key, cacheEntry);
TRACE_COUNTER1("webkit", "ImageDecodingStoreDiscardableMemoryUsageBytes", m_discardableMemoryUsageInBytes);