Chromium Code Reviews| 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 <queue> | |
| 8 #include <unordered_map> | 9 #include <unordered_map> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 12 #include "cc/playback/image_id.h" | 13 #include "cc/playback/image_id.h" |
| 13 #include "cc/tiles/image_controller.h" | 14 #include "cc/tiles/image_controller.h" |
| 14 #include "third_party/skia/include/core/SkImage.h" | 15 #include "third_party/skia/include/core/SkImage.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 | 18 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 44 // The entries remaining in |images| are for images for which a cached decode | 45 // The entries remaining in |images| are for images for which a cached decode |
| 45 // from the image decode service is available, or which must be decoded before | 46 // from the image decode service is available, or which must be decoded before |
| 46 // before this tile can be rasterized. | 47 // before this tile can be rasterized. |
| 47 void FilterImagesForCheckeringForTile(std::vector<DrawImage>* images, | 48 void FilterImagesForCheckeringForTile(std::vector<DrawImage>* images, |
| 48 ImageIdFlatSet* checkered_images, | 49 ImageIdFlatSet* checkered_images, |
| 49 WhichTree tree); | 50 WhichTree tree); |
| 50 | 51 |
| 51 // Returns the set of images to invalidate on the sync tree. | 52 // Returns the set of images to invalidate on the sync tree. |
| 52 const ImageIdFlatSet& TakeImagesToInvalidateOnSyncTree(); | 53 const ImageIdFlatSet& TakeImagesToInvalidateOnSyncTree(); |
| 53 | 54 |
| 55 void ResetImageDecodeQueue(); | |
| 56 | |
| 54 void DidActivateSyncTree(); | 57 void DidActivateSyncTree(); |
| 55 | 58 |
| 56 private: | 59 private: |
| 57 void DidFinishImageDecode(ImageId image_id, | 60 void DidFinishImageDecode(ImageId image_id, |
| 58 ImageController::ImageDecodeRequestId request_id, | 61 ImageController::ImageDecodeRequestId request_id, |
| 59 ImageController::ImageDecodeResult result); | 62 ImageController::ImageDecodeResult result); |
| 60 | 63 |
| 61 // Returns true if the decode for |image| will be deferred to the image decode | 64 // Returns true if the decode for |image| will be deferred to the image decode |
| 62 // service and it should be be skipped during raster. | 65 // service and it should be be skipped during raster. |
| 63 bool ShouldCheckerImage(const sk_sp<const SkImage>& image, | 66 bool ShouldCheckerImage(const sk_sp<const SkImage>& image, |
| 64 WhichTree tree) const; | 67 WhichTree tree) const; |
| 65 | 68 |
| 66 void ScheduleImageDecodeIfNecessary(const sk_sp<const SkImage>& image); | 69 void ScheduleImageDecodeIfNecessary(const sk_sp<const SkImage>& image); |
| 70 void RequestNextImageDecode(); | |
|
vmpstr
2017/03/06 20:45:25
Comment, and if this is what I think it is, then i
Khushal
2017/03/07 00:31:08
Done.
| |
| 67 | 71 |
| 68 ImageController* image_controller_; | 72 ImageController* image_controller_; |
| 69 CheckerImageTrackerClient* client_; | 73 CheckerImageTrackerClient* client_; |
| 70 const bool enable_checker_imaging_; | 74 const bool enable_checker_imaging_; |
| 71 | 75 |
| 72 // A set of images which have been decoded and are pending invalidation for | 76 // A set of images which have been decoded and are pending invalidation for |
| 73 // raster on the checkered tiles. | 77 // raster on the checkered tiles. |
| 74 ImageIdFlatSet images_pending_invalidation_; | 78 ImageIdFlatSet images_pending_invalidation_; |
| 75 | 79 |
| 76 // A set of images which were invalidated on the current sync tree. | 80 // A set of images which were invalidated on the current sync tree. |
| 77 ImageIdFlatSet invalidated_images_on_current_sync_tree_; | 81 ImageIdFlatSet invalidated_images_on_current_sync_tree_; |
| 78 | 82 |
| 79 // A set of images which are currently pending decode from the image decode | 83 // The set of images in the image decode queue. |
| 80 // service. | |
| 81 // TODO(khushalsagar): This should be a queue that gets re-built each time we | |
| 82 // do a PrepareTiles? See crbug.com/689184. | |
| 83 ImageIdFlatSet pending_image_decodes_; | 84 ImageIdFlatSet pending_image_decodes_; |
| 84 | 85 |
| 86 // The queue of images pending decode. We maintain a queue to ensure that the | |
| 87 // order in which images are decoded is aligned with the priority of the tiles | |
| 88 // dependent on these images. | |
| 89 std::queue<sk_sp<const SkImage>> image_decode_request_queue_; | |
|
vmpstr
2017/03/06 20:45:25
std::queue's underlying type is std::deque which i
Khushal
2017/03/07 00:31:09
Done.
| |
| 90 | |
| 85 // A set of images which have been decoded at least once from the | 91 // A set of images which have been decoded at least once from the |
| 86 // ImageDecodeService and should not be checkered again. | 92 // ImageDecodeService and should not be checkered again. |
| 87 // TODO(khushalsagar): Limit the size of this set. | 93 // TODO(khushalsagar): Limit the size of this set. |
| 88 // TODO(khushalsagar): Plumb navigation changes here to reset this. See | 94 // TODO(khushalsagar): Plumb navigation changes here to reset this. See |
| 89 // crbug.com/693228. | 95 // crbug.com/693228. |
| 90 std::unordered_set<ImageId> images_decoded_once_; | 96 std::unordered_set<ImageId> images_decoded_once_; |
| 91 | 97 |
| 92 // A map of image id to image decode request id for images to be unlocked. | 98 // A map of image id to image decode request id for images to be unlocked. |
| 93 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId> | 99 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId> |
| 94 image_id_to_decode_request_id_; | 100 image_id_to_decode_request_id_; |
| 95 | 101 |
| 96 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; | 102 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; |
| 97 }; | 103 }; |
| 98 | 104 |
| 99 } // namespace cc | 105 } // namespace cc |
| 100 | 106 |
| 101 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ | 107 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ |
| OLD | NEW |