| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 bool GetTaskForImageAndRef(const DrawImage& image, | 62 bool GetTaskForImageAndRef(const DrawImage& image, |
| 63 uint64_t prepare_tiles_id, | 63 uint64_t prepare_tiles_id, |
| 64 scoped_refptr<ImageDecodeTask>* task) override; | 64 scoped_refptr<ImageDecodeTask>* task) override; |
| 65 void UnrefImage(const DrawImage& image) override; | 65 void UnrefImage(const DrawImage& image) override; |
| 66 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& draw_image) override; | 66 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& draw_image) override; |
| 67 void DrawWithImageFinished(const DrawImage& image, | 67 void DrawWithImageFinished(const DrawImage& image, |
| 68 const DecodedDrawImage& decoded_image) override; | 68 const DecodedDrawImage& decoded_image) override; |
| 69 void ReduceCacheUsage() override; | 69 void ReduceCacheUsage() override; |
| 70 void SetShouldAggressivelyFreeResources( | 70 void SetShouldAggressivelyFreeResources( |
| 71 bool aggressively_free_resources) override; | 71 bool aggressively_free_resources) override; |
| 72 void ImageDecodeTaskCompleted(Task* task) override; |
| 73 void ImageUploadTaskCompleted(Task* task) override; |
| 72 | 74 |
| 73 // Called by Decode / Upload tasks. | 75 // Called by Decode / Upload tasks. |
| 74 void DecodeImage(const DrawImage& image); | 76 void DecodeImage(const DrawImage& image); |
| 75 void UploadImage(const DrawImage& image); | 77 void UploadImage(const DrawImage& image); |
| 76 void DecodeTaskCompleted(const DrawImage& image); | |
| 77 void UploadTaskCompleted(const DrawImage& image); | |
| 78 | 78 |
| 79 // For testing only. | 79 // For testing only. |
| 80 void SetCachedItemLimitForTesting(size_t limit) { | 80 void SetCachedItemLimitForTesting(size_t limit) { |
| 81 cached_items_limit_ = limit; | 81 cached_items_limit_ = limit; |
| 82 } | 82 } |
| 83 void SetCachedBytesLimitForTesting(size_t limit) { | 83 void SetCachedBytesLimitForTesting(size_t limit) { |
| 84 cached_bytes_limit_ = limit; | 84 cached_bytes_limit_ = limit; |
| 85 } | 85 } |
| 86 size_t GetBytesUsedForTesting() const { return bytes_used_; } | 86 size_t GetBytesUsedForTesting() const { return bytes_used_; } |
| 87 | 87 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 // We can't release GPU backed SkImages without holding the context lock, | 184 // We can't release GPU backed SkImages without holding the context lock, |
| 185 // so we add them to this list and defer deletion until the next time the lock | 185 // so we add them to this list and defer deletion until the next time the lock |
| 186 // is held. | 186 // is held. |
| 187 std::vector<skia::RefPtr<SkImage>> images_pending_deletion_; | 187 std::vector<skia::RefPtr<SkImage>> images_pending_deletion_; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace cc | 190 } // namespace cc |
| 191 | 191 |
| 192 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ | 192 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ |
| OLD | NEW |