OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ | 5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ |
6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ | 6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 sk_sp<const SkImage> image); | 266 sk_sp<const SkImage> image); |
267 | 267 |
268 // GetScaledImageDecode is called by DecodeImageInternal when the quality | 268 // GetScaledImageDecode is called by DecodeImageInternal when the quality |
269 // requires the image be scaled. Like DecodeImageInternal, it should be | 269 // requires the image be scaled. Like DecodeImageInternal, it should be |
270 // called with no lock acquired and it returns nullptr if the decoding or | 270 // called with no lock acquired and it returns nullptr if the decoding or |
271 // scaling failed. | 271 // scaling failed. |
272 std::unique_ptr<DecodedImage> GetScaledImageDecode( | 272 std::unique_ptr<DecodedImage> GetScaledImageDecode( |
273 const ImageKey& key, | 273 const ImageKey& key, |
274 sk_sp<const SkImage> image); | 274 sk_sp<const SkImage> image); |
275 | 275 |
276 void SanityCheckState(int line, bool lock_acquired); | |
277 void RefImage(const ImageKey& key); | 276 void RefImage(const ImageKey& key); |
278 void RefAtRasterImage(const ImageKey& key); | 277 void RefAtRasterImage(const ImageKey& key); |
279 void UnrefAtRasterImage(const ImageKey& key); | 278 void UnrefAtRasterImage(const ImageKey& key); |
280 | 279 |
281 // Helper function which dumps all images in a specific ImageMRUCache. | 280 // Helper function which dumps all images in a specific ImageMRUCache. |
282 void DumpImageMemoryForCache(const ImageMRUCache& cache, | 281 void DumpImageMemoryForCache(const ImageMRUCache& cache, |
283 const char* cache_name, | 282 const char* cache_name, |
284 base::trace_event::ProcessMemoryDump* pmd) const; | 283 base::trace_event::ProcessMemoryDump* pmd) const; |
285 | 284 |
286 // Removes unlocked decoded images until the number of decoded images is | 285 // Removes unlocked decoded images until the number of decoded images is |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 ResourceFormat format_; | 320 ResourceFormat format_; |
322 size_t max_items_in_cache_; | 321 size_t max_items_in_cache_; |
323 | 322 |
324 // Used to uniquely identify DecodedImages for memory traces. | 323 // Used to uniquely identify DecodedImages for memory traces. |
325 base::AtomicSequenceNumber next_tracing_id_; | 324 base::AtomicSequenceNumber next_tracing_id_; |
326 }; | 325 }; |
327 | 326 |
328 } // namespace cc | 327 } // namespace cc |
329 | 328 |
330 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ | 329 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ |
OLD | NEW |