| Index: third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h
|
| diff --git a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h
|
| index 71174569914a055edf1534b606c753d3be334303..465963aa1b2cca2047a80d7adfa8c6e4874e11bd 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h
|
| +++ b/third_party/WebKit/Source/platform/graphics/ImageDecodingStore.h
|
| @@ -31,13 +31,12 @@
|
| #include "platform/PlatformExport.h"
|
| #include "platform/graphics/skia/SkSizeHash.h"
|
| #include "platform/image-decoders/ImageDecoder.h"
|
| -
|
| #include "wtf/DoublyLinkedList.h"
|
| #include "wtf/HashSet.h"
|
| -#include "wtf/OwnPtr.h"
|
| -#include "wtf/PassOwnPtr.h"
|
| +#include "wtf/PtrUtil.h"
|
| #include "wtf/ThreadingPrimitives.h"
|
| #include "wtf/Vector.h"
|
| +#include <memory>
|
|
|
| namespace blink {
|
|
|
| @@ -65,7 +64,7 @@ class PLATFORM_EXPORT ImageDecodingStore final {
|
| USING_FAST_MALLOC(ImageDecodingStore);
|
| WTF_MAKE_NONCOPYABLE(ImageDecodingStore);
|
| public:
|
| - static PassOwnPtr<ImageDecodingStore> create() { return adoptPtr(new ImageDecodingStore); }
|
| + static std::unique_ptr<ImageDecodingStore> create() { return wrapUnique(new ImageDecodingStore); }
|
| ~ImageDecodingStore();
|
|
|
| static ImageDecodingStore& instance();
|
| @@ -74,7 +73,7 @@ public:
|
| // and scaled size. Return true if the cached object is found.
|
| bool lockDecoder(const ImageFrameGenerator*, const SkISize& scaledSize, ImageDecoder**);
|
| void unlockDecoder(const ImageFrameGenerator*, const ImageDecoder*);
|
| - void insertDecoder(const ImageFrameGenerator*, PassOwnPtr<ImageDecoder>);
|
| + void insertDecoder(const ImageFrameGenerator*, std::unique_ptr<ImageDecoder>);
|
| void removeDecoder(const ImageFrameGenerator*, const ImageDecoder*);
|
|
|
| // Remove all cache entries indexed by ImageFrameGenerator.
|
| @@ -136,12 +135,12 @@ private:
|
|
|
| class DecoderCacheEntry final : public CacheEntry {
|
| public:
|
| - static PassOwnPtr<DecoderCacheEntry> create(const ImageFrameGenerator* generator, PassOwnPtr<ImageDecoder> decoder)
|
| + static std::unique_ptr<DecoderCacheEntry> create(const ImageFrameGenerator* generator, std::unique_ptr<ImageDecoder> decoder)
|
| {
|
| - return adoptPtr(new DecoderCacheEntry(generator, 0, std::move(decoder)));
|
| + return wrapUnique(new DecoderCacheEntry(generator, 0, std::move(decoder)));
|
| }
|
|
|
| - DecoderCacheEntry(const ImageFrameGenerator* generator, int count, PassOwnPtr<ImageDecoder> decoder)
|
| + DecoderCacheEntry(const ImageFrameGenerator* generator, int count, std::unique_ptr<ImageDecoder> decoder)
|
| : CacheEntry(generator, count)
|
| , m_cachedDecoder(std::move(decoder))
|
| , m_size(SkISize::Make(m_cachedDecoder->decodedSize().width(), m_cachedDecoder->decodedSize().height()))
|
| @@ -163,7 +162,7 @@ private:
|
| ImageDecoder* cachedDecoder() const { return m_cachedDecoder.get(); }
|
|
|
| private:
|
| - OwnPtr<ImageDecoder> m_cachedDecoder;
|
| + std::unique_ptr<ImageDecoder> m_cachedDecoder;
|
| SkISize m_size;
|
| };
|
|
|
| @@ -172,22 +171,22 @@ private:
|
| void prune();
|
|
|
| // These helper methods are called while m_mutex is locked.
|
| - template<class T, class U, class V> void insertCacheInternal(PassOwnPtr<T> cacheEntry, U* cacheMap, V* identifierMap);
|
| + template<class T, class U, class V> void insertCacheInternal(std::unique_ptr<T> cacheEntry, U* cacheMap, V* identifierMap);
|
|
|
| // Helper method to remove a cache entry. Ownership is transferred to
|
| // deletionList. Use of Vector<> is handy when removing multiple entries.
|
| - template<class T, class U, class V> void removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<OwnPtr<CacheEntry>>* deletionList);
|
| + template<class T, class U, class V> void removeFromCacheInternal(const T* cacheEntry, U* cacheMap, V* identifierMap, Vector<std::unique_ptr<CacheEntry>>* deletionList);
|
|
|
| // Helper method to remove a cache entry. Uses the templated version base on
|
| // the type of cache entry.
|
| - void removeFromCacheInternal(const CacheEntry*, Vector<OwnPtr<CacheEntry>>* deletionList);
|
| + void removeFromCacheInternal(const CacheEntry*, Vector<std::unique_ptr<CacheEntry>>* deletionList);
|
|
|
| // Helper method to remove all cache entries associated with a ImageFraneGenerator.
|
| // Ownership of cache entries is transferred to deletionList.
|
| - template<class U, class V> void removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator*, Vector<OwnPtr<CacheEntry>>* deletionList);
|
| + template<class U, class V> void removeCacheIndexedByGeneratorInternal(U* cacheMap, V* identifierMap, const ImageFrameGenerator*, Vector<std::unique_ptr<CacheEntry>>* deletionList);
|
|
|
| // Helper method to remove cache entry pointers from the LRU list.
|
| - void removeFromCacheListInternal(const Vector<OwnPtr<CacheEntry>>& deletionList);
|
| + void removeFromCacheListInternal(const Vector<std::unique_ptr<CacheEntry>>& deletionList);
|
|
|
| // A doubly linked list that maintains usage history of cache entries.
|
| // This is used for eviction of old entries.
|
| @@ -196,7 +195,7 @@ private:
|
| DoublyLinkedList<CacheEntry> m_orderedCacheList;
|
|
|
| // A lookup table for all decoder cache objects. Owns all decoder cache objects.
|
| - typedef HashMap<DecoderCacheKey, OwnPtr<DecoderCacheEntry>> DecoderCacheMap;
|
| + typedef HashMap<DecoderCacheKey, std::unique_ptr<DecoderCacheEntry>> DecoderCacheMap;
|
| DecoderCacheMap m_decoderCacheMap;
|
|
|
| // A lookup table to map ImageFrameGenerator to all associated
|
|
|