OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_IMAGE_DECODE_CONTROLLER_H_ | 5 #ifndef CC_TILES_IMAGE_DECODE_CONTROLLER_H_ |
6 #define CC_TILES_IMAGE_DECODE_CONTROLLER_H_ | 6 #define CC_TILES_IMAGE_DECODE_CONTROLLER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "cc/playback/decoded_draw_image.h" | 9 #include "cc/playback/decoded_draw_image.h" |
10 #include "cc/playback/draw_image.h" | 10 #include "cc/playback/draw_image.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 class ImageDecodeTask; | 14 class ImageDecodeTask; |
| 15 class Task; |
15 | 16 |
16 // ImageDecodeController is responsible for generating decode tasks, decoding | 17 // ImageDecodeController is responsible for generating decode tasks, decoding |
17 // images, storing images in cache, and being able to return the decoded images | 18 // images, storing images in cache, and being able to return the decoded images |
18 // when requested. | 19 // when requested. |
19 | 20 |
20 // ImageDecodeController is responsible for the following things: | 21 // ImageDecodeController is responsible for the following things: |
21 // 1. Given a DrawImage, it can return an ImageDecodeTask which when run will | 22 // 1. Given a DrawImage, it can return an ImageDecodeTask which when run will |
22 // decode and cache the resulting image. If the image does not need a task to | 23 // decode and cache the resulting image. If the image does not need a task to |
23 // be decoded, then nullptr will be returned. The return value of the | 24 // be decoded, then nullptr will be returned. The return value of the |
24 // function indicates whether the image was or is going to be locked, so an | 25 // function indicates whether the image was or is going to be locked, so an |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const DecodedDrawImage& decoded_image) = 0; | 61 const DecodedDrawImage& decoded_image) = 0; |
61 | 62 |
62 // This function informs the controller that now is a good time to clean up | 63 // This function informs the controller that now is a good time to clean up |
63 // memory. This is called periodically from the compositor thread. | 64 // memory. This is called periodically from the compositor thread. |
64 virtual void ReduceCacheUsage() = 0; | 65 virtual void ReduceCacheUsage() = 0; |
65 | 66 |
66 // This function informs the controller that we are hidden and should not be | 67 // This function informs the controller that we are hidden and should not be |
67 // retaining cached resources longer than needed. | 68 // retaining cached resources longer than needed. |
68 virtual void SetShouldAggressivelyFreeResources( | 69 virtual void SetShouldAggressivelyFreeResources( |
69 bool aggressively_free_resources) = 0; | 70 bool aggressively_free_resources) = 0; |
| 71 |
| 72 // These functions process completion of image decode/upload tasks on origin |
| 73 // thread (i.e. on the compositor thread called by the tile manager). |
| 74 virtual void ImageDecodeTaskCompleted(Task* task) = 0; |
| 75 virtual void ImageUploadTaskCompleted(Task* task) = 0; |
70 }; | 76 }; |
71 | 77 |
72 } // namespace cc | 78 } // namespace cc |
73 | 79 |
74 #endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_ | 80 #endif // CC_TILES_IMAGE_DECODE_CONTROLLER_H_ |
OLD | NEW |