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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // THREAD SAFETY | 60 // THREAD SAFETY |
61 // | 61 // |
62 // All public methods can be used on any thread. | 62 // All public methods can be used on any thread. |
63 | 63 |
64 class PLATFORM_EXPORT ImageDecodingStore final { | 64 class PLATFORM_EXPORT ImageDecodingStore final { |
65 USING_FAST_MALLOC(ImageDecodingStore); | 65 USING_FAST_MALLOC(ImageDecodingStore); |
66 WTF_MAKE_NONCOPYABLE(ImageDecodingStore); | 66 WTF_MAKE_NONCOPYABLE(ImageDecodingStore); |
67 | 67 |
68 public: | 68 public: |
69 static std::unique_ptr<ImageDecodingStore> create() { | 69 static std::unique_ptr<ImageDecodingStore> create() { |
70 return wrapUnique(new ImageDecodingStore); | 70 return WTF::wrapUnique(new ImageDecodingStore); |
71 } | 71 } |
72 ~ImageDecodingStore(); | 72 ~ImageDecodingStore(); |
73 | 73 |
74 static ImageDecodingStore& instance(); | 74 static ImageDecodingStore& instance(); |
75 | 75 |
76 // Accesses a cached decoder object. A decoder is indexed by origin | 76 // Accesses a cached decoder object. A decoder is indexed by origin |
77 // (ImageFrameGenerator) and scaled size. Returns true if the cached object is | 77 // (ImageFrameGenerator) and scaled size. Returns true if the cached object is |
78 // found. | 78 // found. |
79 bool lockDecoder(const ImageFrameGenerator*, | 79 bool lockDecoder(const ImageFrameGenerator*, |
80 const SkISize& scaledSize, | 80 const SkISize& scaledSize, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 private: | 134 private: |
135 CacheEntry* m_prev; | 135 CacheEntry* m_prev; |
136 CacheEntry* m_next; | 136 CacheEntry* m_next; |
137 }; | 137 }; |
138 | 138 |
139 class DecoderCacheEntry final : public CacheEntry { | 139 class DecoderCacheEntry final : public CacheEntry { |
140 public: | 140 public: |
141 static std::unique_ptr<DecoderCacheEntry> create( | 141 static std::unique_ptr<DecoderCacheEntry> create( |
142 const ImageFrameGenerator* generator, | 142 const ImageFrameGenerator* generator, |
143 std::unique_ptr<ImageDecoder> decoder) { | 143 std::unique_ptr<ImageDecoder> decoder) { |
144 return wrapUnique( | 144 return WTF::wrapUnique( |
145 new DecoderCacheEntry(generator, 0, std::move(decoder))); | 145 new DecoderCacheEntry(generator, 0, std::move(decoder))); |
146 } | 146 } |
147 | 147 |
148 DecoderCacheEntry(const ImageFrameGenerator* generator, | 148 DecoderCacheEntry(const ImageFrameGenerator* generator, |
149 int count, | 149 int count, |
150 std::unique_ptr<ImageDecoder> decoder) | 150 std::unique_ptr<ImageDecoder> decoder) |
151 : CacheEntry(generator, count), | 151 : CacheEntry(generator, count), |
152 m_cachedDecoder(std::move(decoder)), | 152 m_cachedDecoder(std::move(decoder)), |
153 m_size(SkISize::Make(m_cachedDecoder->decodedSize().width(), | 153 m_size(SkISize::Make(m_cachedDecoder->decodedSize().width(), |
154 m_cachedDecoder->decodedSize().height())) {} | 154 m_cachedDecoder->decodedSize().height())) {} |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // m_heapLimitInBytes | 246 // m_heapLimitInBytes |
247 // m_heapMemoryUsageInBytes | 247 // m_heapMemoryUsageInBytes |
248 // This mutex also protects calls to underlying skBitmap's | 248 // This mutex also protects calls to underlying skBitmap's |
249 // lockPixels()/unlockPixels() as they are not threadsafe. | 249 // lockPixels()/unlockPixels() as they are not threadsafe. |
250 Mutex m_mutex; | 250 Mutex m_mutex; |
251 }; | 251 }; |
252 | 252 |
253 } // namespace blink | 253 } // namespace blink |
254 | 254 |
255 #endif | 255 #endif |
OLD | NEW |