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_CONTROLLER_H_ | 5 #ifndef CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 6 #define CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // called with no lock acquired and it returns nullptr if the decoding or | 253 // called with no lock acquired and it returns nullptr if the decoding or |
254 // scaling failed. | 254 // scaling failed. |
255 std::unique_ptr<DecodedImage> GetScaledImageDecode( | 255 std::unique_ptr<DecodedImage> GetScaledImageDecode( |
256 const ImageKey& key, | 256 const ImageKey& key, |
257 sk_sp<const SkImage> image); | 257 sk_sp<const SkImage> image); |
258 | 258 |
259 void SanityCheckState(int line, bool lock_acquired); | 259 void SanityCheckState(int line, bool lock_acquired); |
260 void RefImage(const ImageKey& key); | 260 void RefImage(const ImageKey& key); |
261 void RefAtRasterImage(const ImageKey& key); | 261 void RefAtRasterImage(const ImageKey& key); |
262 void UnrefAtRasterImage(const ImageKey& key); | 262 void UnrefAtRasterImage(const ImageKey& key); |
| 263 void ReduceCacheUsageInternal(size_t max_items); |
263 | 264 |
264 // Helper function which dumps all images in a specific ImageMRUCache. | 265 // Helper function which dumps all images in a specific ImageMRUCache. |
265 void DumpImageMemoryForCache(const ImageMRUCache& cache, | 266 void DumpImageMemoryForCache(const ImageMRUCache& cache, |
266 const char* cache_name, | 267 const char* cache_name, |
267 base::trace_event::ProcessMemoryDump* pmd) const; | 268 base::trace_event::ProcessMemoryDump* pmd) const; |
268 | 269 |
269 // Overriden from base::MemoryCoordinatorClient. | 270 // Overriden from base::MemoryCoordinatorClient. |
270 void OnMemoryStateChange(base::MemoryState state) override; | 271 void OnMemoryStateChange(base::MemoryState state) override; |
271 | 272 |
272 std::unordered_map<ImageKey, scoped_refptr<TileTask>, ImageKeyHash> | 273 std::unordered_map<ImageKey, scoped_refptr<TileTask>, ImageKeyHash> |
(...skipping 16 matching lines...) Expand all Loading... |
289 | 290 |
290 ResourceFormat format_; | 291 ResourceFormat format_; |
291 | 292 |
292 // Used to uniquely identify DecodedImages for memory traces. | 293 // Used to uniquely identify DecodedImages for memory traces. |
293 base::AtomicSequenceNumber next_tracing_id_; | 294 base::AtomicSequenceNumber next_tracing_id_; |
294 }; | 295 }; |
295 | 296 |
296 } // namespace cc | 297 } // namespace cc |
297 | 298 |
298 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 299 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
OLD | NEW |