| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // Called when the sync tree is activated. Each call to | 51 // Called when the sync tree is activated. Each call to |
| 52 // TakeImagesToInvalidateOnSyncTree() must be followed by this when the | 52 // TakeImagesToInvalidateOnSyncTree() must be followed by this when the |
| 53 // invalidated sync tree is activated. | 53 // invalidated sync tree is activated. |
| 54 void DidActivateSyncTree(); | 54 void DidActivateSyncTree(); |
| 55 | 55 |
| 56 // Called to reset the tracker state on navigation. This will release all | 56 // Called to reset the tracker state on navigation. This will release all |
| 57 // cached images. Setting |can_clear_decode_policy_tracking| will also result | 57 // cached images. Setting |can_clear_decode_policy_tracking| will also result |
| 58 // in re-checkering any images already decoded by the tracker. | 58 // in re-checkering any images already decoded by the tracker. |
| 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 |
| 62 // out of the checkering behavior for certain images, such as ones that were |
| 63 // decoded using the img.decode api. |
| 64 void DisallowCheckeringForImage(const PaintImage& image); |
| 65 |
| 61 private: | 66 private: |
| 62 enum class DecodePolicy { | 67 enum class DecodePolicy { |
| 63 // The image can be decoded asynchronously from raster. When set, the image | 68 // The image can be decoded asynchronously from raster. When set, the image |
| 64 // is always skipped during rasterization of content that includes this | 69 // is always skipped during rasterization of content that includes this |
| 65 // image until it has been decoded using the decode service. | 70 // image until it has been decoded using the decode service. |
| 66 ASYNC, | 71 ASYNC, |
| 67 // The image has been decoded asynchronously once and should now be | 72 // The image has been decoded asynchronously once and should now be |
| 68 // synchronously rasterized with the content. | 73 // synchronously rasterized with the content. |
| 69 SYNC_DECODED_ONCE, | 74 SYNC_DECODED_ONCE, |
| 70 // The image has been permanently vetoed from being decoded async. | 75 // The image has been permanently vetoed from being decoded async. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 base::Optional<PaintImage> outstanding_image_decode_; | 121 base::Optional<PaintImage> outstanding_image_decode_; |
| 117 | 122 |
| 118 // A map of ImageId to its DecodePolicy. | 123 // A map of ImageId to its DecodePolicy. |
| 119 std::unordered_map<PaintImage::Id, DecodePolicy> image_async_decode_state_; | 124 std::unordered_map<PaintImage::Id, DecodePolicy> image_async_decode_state_; |
| 120 | 125 |
| 121 // A map of image id to image decode request id for images to be unlocked. | 126 // A map of image id to image decode request id for images to be unlocked. |
| 122 std::unordered_map<PaintImage::Id, std::unique_ptr<ScopedDecodeHolder>> | 127 std::unordered_map<PaintImage::Id, std::unique_ptr<ScopedDecodeHolder>> |
| 123 image_id_to_decode_; | 128 image_id_to_decode_; |
| 124 | 129 |
| 125 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; | 130 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; |
| 131 |
| 132 DISALLOW_COPY_AND_ASSIGN(CheckerImageTracker); |
| 126 }; | 133 }; |
| 127 | 134 |
| 128 } // namespace cc | 135 } // namespace cc |
| 129 | 136 |
| 130 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ | 137 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ |
| OLD | NEW |