| 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 <unordered_map> | 10 #include <unordered_map> |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void SanityCheckState(int line, bool lock_acquired); | 193 void SanityCheckState(int line, bool lock_acquired); |
| 194 void RefImage(const ImageKey& key); | 194 void RefImage(const ImageKey& key); |
| 195 void RefAtRasterImage(const ImageKey& key); | 195 void RefAtRasterImage(const ImageKey& key); |
| 196 void UnrefAtRasterImage(const ImageKey& key); | 196 void UnrefAtRasterImage(const ImageKey& key); |
| 197 | 197 |
| 198 // These functions indicate whether the images can be handled and cached by | 198 // These functions indicate whether the images can be handled and cached by |
| 199 // ImageDecodeController or whether they will fall through to Skia (with | 199 // ImageDecodeController or whether they will fall through to Skia (with |
| 200 // exception of possibly prerolling them). Over time these should return | 200 // exception of possibly prerolling them). Over time these should return |
| 201 // "false" in less cases, as the ImageDecodeController should start handling | 201 // "false" in less cases, as the ImageDecodeController should start handling |
| 202 // more of them. | 202 // more of them. |
| 203 bool CanHandleImage(const ImageKey& key, const DrawImage& image); | 203 bool CanHandleImage(const ImageKey& key); |
| 204 bool CanHandleFilterQuality(SkFilterQuality filter_quality); | |
| 205 | 204 |
| 206 std::unordered_map<ImageKey, scoped_refptr<ImageDecodeTask>, ImageKeyHash> | 205 std::unordered_map<ImageKey, scoped_refptr<ImageDecodeTask>, ImageKeyHash> |
| 207 pending_image_tasks_; | 206 pending_image_tasks_; |
| 208 | 207 |
| 209 // The members below this comment can only be accessed if the lock is held to | 208 // The members below this comment can only be accessed if the lock is held to |
| 210 // ensure that they are safe to access on multiple threads. | 209 // ensure that they are safe to access on multiple threads. |
| 211 base::Lock lock_; | 210 base::Lock lock_; |
| 212 | 211 |
| 213 std::deque<AnnotatedDecodedImage> decoded_images_; | 212 std::deque<AnnotatedDecodedImage> decoded_images_; |
| 214 std::unordered_map<ImageKey, int, ImageKeyHash> decoded_images_ref_counts_; | 213 std::unordered_map<ImageKey, int, ImageKeyHash> decoded_images_ref_counts_; |
| 215 std::deque<AnnotatedDecodedImage> at_raster_decoded_images_; | 214 std::deque<AnnotatedDecodedImage> at_raster_decoded_images_; |
| 216 std::unordered_map<ImageKey, int, ImageKeyHash> | 215 std::unordered_map<ImageKey, int, ImageKeyHash> |
| 217 at_raster_decoded_images_ref_counts_; | 216 at_raster_decoded_images_ref_counts_; |
| 218 MemoryBudget locked_images_budget_; | 217 MemoryBudget locked_images_budget_; |
| 219 | 218 |
| 220 // Note that this is used for cases where the only thing we do is preroll the | 219 // Note that this is used for cases where the only thing we do is preroll the |
| 221 // image the first time we see it. This mimics the previous behavior and | 220 // image the first time we see it. This mimics the previous behavior and |
| 222 // should over time change as the compositor starts to handle more cases. | 221 // should over time change as the compositor starts to handle more cases. |
| 223 std::unordered_set<uint32_t> prerolled_images_; | 222 std::unordered_set<uint32_t> prerolled_images_; |
| 224 }; | 223 }; |
| 225 | 224 |
| 226 } // namespace cc | 225 } // namespace cc |
| 227 | 226 |
| 228 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 227 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
| OLD | NEW |