OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 ImageDecodingStore::~ImageDecodingStore() | 46 ImageDecodingStore::~ImageDecodingStore() |
47 { | 47 { |
48 #if ENABLE(ASSERT) | 48 #if ENABLE(ASSERT) |
49 setCacheLimitInBytes(0); | 49 setCacheLimitInBytes(0); |
50 ASSERT(!m_decoderCacheMap.size()); | 50 ASSERT(!m_decoderCacheMap.size()); |
51 ASSERT(!m_orderedCacheList.size()); | 51 ASSERT(!m_orderedCacheList.size()); |
52 ASSERT(!m_decoderCacheKeyMap.size()); | 52 ASSERT(!m_decoderCacheKeyMap.size()); |
53 #endif | 53 #endif |
54 } | 54 } |
55 | 55 |
56 ImageDecodingStore* ImageDecodingStore::instance() | 56 ImageDecodingStore& ImageDecodingStore::instance() |
57 { | 57 { |
58 AtomicallyInitializedStatic(ImageDecodingStore*, store = ImageDecodingStore:
:create().leakPtr()); | 58 AtomicallyInitializedStaticReference(ImageDecodingStore, store, ImageDecodin
gStore::create().leakPtr()); |
59 return store; | 59 return store; |
60 } | 60 } |
61 | 61 |
62 bool ImageDecodingStore::lockDecoder(const ImageFrameGenerator* generator, const
SkISize& scaledSize, ImageDecoder** decoder) | 62 bool ImageDecodingStore::lockDecoder(const ImageFrameGenerator* generator, const
SkISize& scaledSize, ImageDecoder** decoder) |
63 { | 63 { |
64 ASSERT(decoder); | 64 ASSERT(decoder); |
65 | 65 |
66 MutexLocker lock(m_mutex); | 66 MutexLocker lock(m_mutex); |
67 DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntry::m
akeCacheKey(generator, scaledSize)); | 67 DecoderCacheMap::iterator iter = m_decoderCacheMap.find(DecoderCacheEntry::m
akeCacheKey(generator, scaledSize)); |
68 if (iter == m_decoderCacheMap.end()) | 68 if (iter == m_decoderCacheMap.end()) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 void ImageDecodingStore::removeFromCacheListInternal(const Vector<OwnPtr<CacheEn
try>>& deletionList) | 285 void ImageDecodingStore::removeFromCacheListInternal(const Vector<OwnPtr<CacheEn
try>>& deletionList) |
286 { | 286 { |
287 for (size_t i = 0; i < deletionList.size(); ++i) | 287 for (size_t i = 0; i < deletionList.size(); ++i) |
288 m_orderedCacheList.remove(deletionList[i].get()); | 288 m_orderedCacheList.remove(deletionList[i].get()); |
289 } | 289 } |
290 | 290 |
291 } // namespace blink | 291 } // namespace blink |
OLD | NEW |