| 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 void RefAtRasterImage(const ImageKey& key); | 266 void RefAtRasterImage(const ImageKey& key); |
| 267 void UnrefAtRasterImage(const ImageKey& key); | 267 void UnrefAtRasterImage(const ImageKey& key); |
| 268 | 268 |
| 269 // Helper function which dumps all images in a specific ImageMRUCache. | 269 // Helper function which dumps all images in a specific ImageMRUCache. |
| 270 void DumpImageMemoryForCache(const ImageMRUCache& cache, | 270 void DumpImageMemoryForCache(const ImageMRUCache& cache, |
| 271 const char* cache_name, | 271 const char* cache_name, |
| 272 base::trace_event::ProcessMemoryDump* pmd) const; | 272 base::trace_event::ProcessMemoryDump* pmd) const; |
| 273 | 273 |
| 274 // Overriden from base::MemoryCoordinatorClient. | 274 // Overriden from base::MemoryCoordinatorClient. |
| 275 void OnMemoryStateChange(base::MemoryState state) override; | 275 void OnMemoryStateChange(base::MemoryState state) override; |
| 276 void OnPurgeMemory() override; |
| 276 | 277 |
| 277 // Helper method to get the different tasks. Note that this should be used as | 278 // Helper method to get the different tasks. Note that this should be used as |
| 278 // if it was public (ie, all of the locks need to be properly acquired). | 279 // if it was public (ie, all of the locks need to be properly acquired). |
| 279 bool GetTaskForImageAndRefInternal(const DrawImage& image, | 280 bool GetTaskForImageAndRefInternal(const DrawImage& image, |
| 280 const TracingInfo& tracing_info, | 281 const TracingInfo& tracing_info, |
| 281 DecodeTaskType type, | 282 DecodeTaskType type, |
| 282 scoped_refptr<TileTask>* task); | 283 scoped_refptr<TileTask>* task); |
| 283 | 284 |
| 284 std::unordered_map<ImageKey, scoped_refptr<TileTask>, ImageKeyHash> | 285 std::unordered_map<ImageKey, scoped_refptr<TileTask>, ImageKeyHash> |
| 285 pending_in_raster_image_tasks_; | 286 pending_in_raster_image_tasks_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 304 ResourceFormat format_; | 305 ResourceFormat format_; |
| 305 size_t max_items_in_cache_; | 306 size_t max_items_in_cache_; |
| 306 | 307 |
| 307 // Used to uniquely identify DecodedImages for memory traces. | 308 // Used to uniquely identify DecodedImages for memory traces. |
| 308 base::AtomicSequenceNumber next_tracing_id_; | 309 base::AtomicSequenceNumber next_tracing_id_; |
| 309 }; | 310 }; |
| 310 | 311 |
| 311 } // namespace cc | 312 } // namespace cc |
| 312 | 313 |
| 313 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ | 314 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CACHE_H_ |
| OLD | NEW |