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 <unordered_map> | 8 #include <unordered_map> |
9 #include <unordered_set> | 9 #include <unordered_set> |
10 | 10 |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/tiles/image_decode_controller.h" | 13 #include "cc/tiles/image_decode_controller.h" |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class CC_EXPORT GpuImageDecodeController : public ImageDecodeController { | 17 class CC_EXPORT GpuImageDecodeController : public ImageDecodeController { |
18 public: | 18 public: |
19 GpuImageDecodeController(); | 19 GpuImageDecodeController(); |
20 ~GpuImageDecodeController() override; | 20 ~GpuImageDecodeController() override; |
21 | 21 |
22 // ImageDecodeController overrides. | 22 // ImageDecodeController overrides. |
23 bool GetTaskForImageAndRef(const DrawImage& image, | 23 bool GetTaskForImageAndRef(const DrawImage& image, |
24 uint64_t prepare_tiles_id, | 24 uint64_t prepare_tiles_id, |
25 scoped_refptr<ImageDecodeTask>* task) override; | 25 scoped_refptr<ImageDecodeTask>* task) override; |
26 void UnrefImage(const DrawImage& image) override; | 26 void UnrefImage(const DrawImage& image) override; |
27 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& draw_image) override; | 27 DecodedDrawImage GetDecodedImageForDraw(const DrawImage& draw_image) override; |
28 void DrawWithImageFinished(const DrawImage& image, | 28 void DrawWithImageFinished(const DrawImage& image, |
29 const DecodedDrawImage& decoded_image) override; | 29 const DecodedDrawImage& decoded_image) override; |
| 30 void CompleteTask(Task* task) override; |
30 void ReduceCacheUsage() override; | 31 void ReduceCacheUsage() override; |
31 | 32 |
32 void DecodeImage(const DrawImage& image); | 33 void DecodeImage(const DrawImage& image); |
33 | 34 |
34 void RemovePendingTaskForImage(const DrawImage& image); | 35 void RemovePendingTaskForImage(const DrawImage& image); |
35 | 36 |
36 private: | 37 private: |
37 base::Lock lock_; | 38 base::Lock lock_; |
38 | 39 |
39 std::unordered_set<uint32_t> prerolled_images_; | 40 std::unordered_set<uint32_t> prerolled_images_; |
40 std::unordered_map<uint32_t, scoped_refptr<ImageDecodeTask>> | 41 std::unordered_map<uint32_t, scoped_refptr<ImageDecodeTask>> |
41 pending_image_tasks_; | 42 pending_image_tasks_; |
42 }; | 43 }; |
43 | 44 |
44 } // namespace cc | 45 } // namespace cc |
45 | 46 |
46 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ | 47 #endif // CC_TILES_GPU_IMAGE_DECODE_CONTROLLER_H_ |
OLD | NEW |