| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_CHECKER_IMAGE_TRACKER_H_ | 5 #ifndef CC_TILES_CHECKER_IMAGE_TRACKER_H_ |
| 6 #define CC_TILES_CHECKER_IMAGE_TRACKER_H_ | 6 #define CC_TILES_CHECKER_IMAGE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void ClearTracker(bool can_clear_decode_policy_tracking); | 59 void ClearTracker(bool can_clear_decode_policy_tracking); |
| 60 | 60 |
| 61 // Informs the tracker to not checker the given image. This can be used to opt | 61 // Informs the tracker to not checker the given image. This can be used to opt |
| 62 // out of the checkering behavior for certain images, such as ones that were | 62 // out of the checkering behavior for certain images, such as ones that were |
| 63 // decoded using the img.decode api. | 63 // decoded using the img.decode api. |
| 64 // Note that if the image is already being checkered, then it will continue to | 64 // Note that if the image is already being checkered, then it will continue to |
| 65 // do so. This call is meant to be issued prior to the image appearing during | 65 // do so. This call is meant to be issued prior to the image appearing during |
| 66 // raster. | 66 // raster. |
| 67 void DisallowCheckeringForImage(const PaintImage& image); | 67 void DisallowCheckeringForImage(const PaintImage& image); |
| 68 | 68 |
| 69 bool has_locked_decodes_for_testing() const { |
| 70 return !image_id_to_decode_.empty(); |
| 71 } |
| 72 |
| 69 private: | 73 private: |
| 70 enum class DecodePolicy { | 74 enum class DecodePolicy { |
| 71 // The image can be decoded asynchronously from raster. When set, the image | 75 // The image can be decoded asynchronously from raster. When set, the image |
| 72 // is always skipped during rasterization of content that includes this | 76 // is always skipped during rasterization of content that includes this |
| 73 // image until it has been decoded using the decode service. | 77 // image until it has been decoded using the decode service. |
| 74 ASYNC, | 78 ASYNC, |
| 75 // The image has been decoded asynchronously once and should now be | 79 // The image has been decoded asynchronously once and should now be |
| 76 // synchronously rasterized with the content or the image has been | 80 // synchronously rasterized with the content or the image has been |
| 77 // permanently vetoed from being decoded async. | 81 // permanently vetoed from being decoded async. |
| 78 SYNC | 82 SYNC |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 image_id_to_decode_; | 146 image_id_to_decode_; |
| 143 | 147 |
| 144 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; | 148 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; |
| 145 | 149 |
| 146 DISALLOW_COPY_AND_ASSIGN(CheckerImageTracker); | 150 DISALLOW_COPY_AND_ASSIGN(CheckerImageTracker); |
| 147 }; | 151 }; |
| 148 | 152 |
| 149 } // namespace cc | 153 } // namespace cc |
| 150 | 154 |
| 151 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ | 155 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ |
| OLD | NEW |