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