| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // ImageDecodeController overrides. | 105 // ImageDecodeController overrides. |
| 106 bool GetTaskForImageAndRef(const DrawImage& image, | 106 bool GetTaskForImageAndRef(const DrawImage& image, |
| 107 uint64_t prepare_tiles_id, | 107 uint64_t prepare_tiles_id, |
| 108 scoped_refptr<ImageDecodeTask>* task) override; | 108 scoped_refptr<ImageDecodeTask>* task) override; |
| 109 void UnrefImage(const DrawImage& image) override; | 109 void UnrefImage(const DrawImage& image) override; |
| 110 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) override; | 110 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& image) override; |
| 111 void DrawWithImageFinished(const DrawImage& image, | 111 void DrawWithImageFinished(const DrawImage& image, |
| 112 const DecodedDrawImage& decoded_image) override; | 112 const DecodedDrawImage& decoded_image) override; |
| 113 void ReduceCacheUsage() override; | 113 void ReduceCacheUsage() override; |
| 114 // Software doesn't keep outstanding images pinned, so this is a no-op. |
| 115 void SetShouldAggressivelyFreeResources( |
| 116 bool aggressively_free_resources) override {} |
| 114 | 117 |
| 115 // Decode the given image and store it in the cache. This is only called by an | 118 // Decode the given image and store it in the cache. This is only called by an |
| 116 // image decode task from a worker thread. | 119 // image decode task from a worker thread. |
| 117 void DecodeImage(const ImageKey& key, const DrawImage& image); | 120 void DecodeImage(const ImageKey& key, const DrawImage& image); |
| 118 | 121 |
| 119 void RemovePendingTask(const ImageKey& key); | 122 void RemovePendingTask(const ImageKey& key); |
| 120 | 123 |
| 121 private: | 124 private: |
| 122 // DecodedImage is a convenience storage for discardable memory. It can also | 125 // DecodedImage is a convenience storage for discardable memory. It can also |
| 123 // construct an image out of SkImageInfo and stored discardable memory. | 126 // construct an image out of SkImageInfo and stored discardable memory. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // image the first time we see it. This mimics the previous behavior and | 227 // image the first time we see it. This mimics the previous behavior and |
| 225 // should over time change as the compositor starts to handle more cases. | 228 // should over time change as the compositor starts to handle more cases. |
| 226 std::unordered_set<uint32_t> prerolled_images_; | 229 std::unordered_set<uint32_t> prerolled_images_; |
| 227 | 230 |
| 228 ResourceFormat format_; | 231 ResourceFormat format_; |
| 229 }; | 232 }; |
| 230 | 233 |
| 231 } // namespace cc | 234 } // namespace cc |
| 232 | 235 |
| 233 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ | 236 #endif // CC_TILES_SOFTWARE_IMAGE_DECODE_CONTROLLER_H_ |
| OLD | NEW |