| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 const ImageKey& key, | 257 const ImageKey& key, |
| 258 sk_sp<const SkImage> image); | 258 sk_sp<const SkImage> image); |
| 259 | 259 |
| 260 // GetSubrectImageDecode is similar to GetOriginalSizeImageDecode in that no | 260 // GetSubrectImageDecode is similar to GetOriginalSizeImageDecode in that no |
| 261 // scale is performed on the image. However, we extract a subrect (copy it | 261 // scale is performed on the image. However, we extract a subrect (copy it |
| 262 // out) and only return this subrect in order to cache a smaller amount of | 262 // out) and only return this subrect in order to cache a smaller amount of |
| 263 // memory. Note that this uses GetOriginalSizeImageDecode to get the initial | 263 // memory. Note that this uses GetOriginalSizeImageDecode to get the initial |
| 264 // data, which ensures that we cache an unlocked version of the original image | 264 // data, which ensures that we cache an unlocked version of the original image |
| 265 // in case we need to extract multiple subrects (as would be the case in an | 265 // in case we need to extract multiple subrects (as would be the case in an |
| 266 // atlas). | 266 // atlas). |
| 267 std::unique_ptr<DecodedImage> GetSubrectImageDecode( | 267 std::unique_ptr<DecodedImage> GetSubrectImageDecode(const ImageKey& key, |
| 268 const ImageKey& key, | 268 PaintImage image); |
| 269 sk_sp<const SkImage> image); | |
| 270 | 269 |
| 271 // GetScaledImageDecode is called by DecodeImageInternal when the quality | 270 // GetScaledImageDecode is called by DecodeImageInternal when the quality |
| 272 // requires the image be scaled. Like DecodeImageInternal, it should be | 271 // requires the image be scaled. Like DecodeImageInternal, it should be |
| 273 // called with no lock acquired and it returns nullptr if the decoding or | 272 // called with no lock acquired and it returns nullptr if the decoding or |
| 274 // scaling failed. | 273 // scaling failed. |
| 275 std::unique_ptr<DecodedImage> GetScaledImageDecode( | 274 std::unique_ptr<DecodedImage> GetScaledImageDecode(const ImageKey& key, |
| 276 const ImageKey& key, | 275 PaintImage image); |
| 277 sk_sp<const SkImage> image); | |
| 278 | 276 |
| 279 void RefImage(const ImageKey& key); | 277 void RefImage(const ImageKey& key); |
| 280 void RefAtRasterImage(const ImageKey& key); | 278 void RefAtRasterImage(const ImageKey& key); |
| 281 void UnrefAtRasterImage(const ImageKey& key); | 279 void UnrefAtRasterImage(const ImageKey& key); |
| 282 | 280 |
| 283 // Helper function which dumps all images in a specific ImageMRUCache. | 281 // Helper function which dumps all images in a specific ImageMRUCache. |
| 284 void DumpImageMemoryForCache(const ImageMRUCache& cache, | 282 void DumpImageMemoryForCache(const ImageMRUCache& cache, |
| 285 const char* cache_name, | 283 const char* cache_name, |
| 286 base::trace_event::ProcessMemoryDump* pmd) const; | 284 base::trace_event::ProcessMemoryDump* pmd) const; |
| 287 | 285 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 ResourceFormat format_; | 323 ResourceFormat format_; |
| 326 size_t max_items_in_cache_; | 324 size_t max_items_in_cache_; |
| 327 | 325 |
| 328 // Used to uniquely identify DecodedImages for memory traces. | 326 // Used to uniquely identify DecodedImages for memory traces. |
| 329 base::AtomicSequenceNumber next_tracing_id_; | 327 base::AtomicSequenceNumber next_tracing_id_; |
| 330 }; | 328 }; |
| 331 | 329 |
| 332 } // namespace cc | 330 } // namespace cc |
| 333 | 331 |
| 334 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ | 332 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ |
| OLD | NEW |