| 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_GPU_IMAGE_DECODE_CONTROLLER_H_ | 5 #ifndef CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ |
| 6 #define CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ | 6 #define CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void UploadTaskCompleted(const DrawImage& image); | 83 void UploadTaskCompleted(const DrawImage& image); |
| 84 | 84 |
| 85 // For testing only. | 85 // For testing only. |
| 86 void SetCachedItemLimitForTesting(size_t limit) { | 86 void SetCachedItemLimitForTesting(size_t limit) { |
| 87 cached_items_limit_ = limit; | 87 cached_items_limit_ = limit; |
| 88 } | 88 } |
| 89 void SetCachedBytesLimitForTesting(size_t limit) { | 89 void SetCachedBytesLimitForTesting(size_t limit) { |
| 90 cached_bytes_limit_ = limit; | 90 cached_bytes_limit_ = limit; |
| 91 } | 91 } |
| 92 size_t GetBytesUsedForTesting() const { return bytes_used_; } | 92 size_t GetBytesUsedForTesting() const { return bytes_used_; } |
| 93 void SetImageDecodingFailedForTesting(const DrawImage& image); |
| 93 | 94 |
| 94 private: | 95 private: |
| 95 enum class DecodedDataMode { GPU, CPU }; | 96 enum class DecodedDataMode { GPU, CPU }; |
| 96 | 97 |
| 97 // Stores the CPU-side decoded bits of an image and supporting fields. | 98 // Stores the CPU-side decoded bits of an image and supporting fields. |
| 98 struct DecodedImageData { | 99 struct DecodedImageData { |
| 99 DecodedImageData(); | 100 DecodedImageData(); |
| 100 ~DecodedImageData(); | 101 ~DecodedImageData(); |
| 101 | 102 |
| 102 // May be null if image not yet decoded. | 103 // May be null if image not yet decoded. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 190 |
| 190 // We can't release GPU backed SkImages without holding the context lock, | 191 // We can't release GPU backed SkImages without holding the context lock, |
| 191 // so we add them to this list and defer deletion until the next time the lock | 192 // so we add them to this list and defer deletion until the next time the lock |
| 192 // is held. | 193 // is held. |
| 193 std::vector<sk_sp<SkImage>> images_pending_deletion_; | 194 std::vector<sk_sp<SkImage>> images_pending_deletion_; |
| 194 }; | 195 }; |
| 195 | 196 |
| 196 } // namespace cc | 197 } // namespace cc |
| 197 | 198 |
| 198 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ | 199 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ |
| OLD | NEW |