| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void SetShouldAggressivelyFreeResources( | 72 void SetShouldAggressivelyFreeResources( |
| 73 bool aggressively_free_resources) override; | 73 bool aggressively_free_resources) override; |
| 74 | 74 |
| 75 // MemoryDumpProvider overrides. | 75 // MemoryDumpProvider overrides. |
| 76 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 76 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 77 base::trace_event::ProcessMemoryDump* pmd) override; | 77 base::trace_event::ProcessMemoryDump* pmd) override; |
| 78 | 78 |
| 79 // Called by Decode / Upload tasks. | 79 // Called by Decode / Upload tasks. |
| 80 void DecodeImage(const DrawImage& image); | 80 void DecodeImage(const DrawImage& image); |
| 81 void UploadImage(const DrawImage& image); | 81 void UploadImage(const DrawImage& image); |
| 82 void DecodeTaskCompleted(const DrawImage& image); | 82 |
| 83 void UploadTaskCompleted(const DrawImage& image); | 83 // Called by Decode / Upload tasks when tasks are finished. |
| 84 void OnImageDecodeTaskCompleted(const DrawImage& image); |
| 85 void OnImageUploadTaskCompleted(const DrawImage& image); |
| 84 | 86 |
| 85 // For testing only. | 87 // For testing only. |
| 86 void SetCachedItemLimitForTesting(size_t limit) { | 88 void SetCachedItemLimitForTesting(size_t limit) { |
| 87 cached_items_limit_ = limit; | 89 cached_items_limit_ = limit; |
| 88 } | 90 } |
| 89 void SetCachedBytesLimitForTesting(size_t limit) { | 91 void SetCachedBytesLimitForTesting(size_t limit) { |
| 90 cached_bytes_limit_ = limit; | 92 cached_bytes_limit_ = limit; |
| 91 } | 93 } |
| 92 size_t GetBytesUsedForTesting() const { return bytes_used_; } | 94 size_t GetBytesUsedForTesting() const { return bytes_used_; } |
| 93 void SetImageDecodingFailedForTesting(const DrawImage& image); | 95 void SetImageDecodingFailedForTesting(const DrawImage& image); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 192 |
| 191 // We can't release GPU backed SkImages without holding the context lock, | 193 // We can't release GPU backed SkImages without holding the context lock, |
| 192 // so we add them to this list and defer deletion until the next time the lock | 194 // so we add them to this list and defer deletion until the next time the lock |
| 193 // is held. | 195 // is held. |
| 194 std::vector<sk_sp<SkImage>> images_pending_deletion_; | 196 std::vector<sk_sp<SkImage>> images_pending_deletion_; |
| 195 }; | 197 }; |
| 196 | 198 |
| 197 } // namespace cc | 199 } // namespace cc |
| 198 | 200 |
| 199 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ | 201 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ |
| OLD | NEW |