Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: cc/tiles/checker_image_tracker.h

Issue 2817473002: cc: Use an enum for tracking images vetoed for async decodes. (Closed)
Patch Set: addressed comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/tiles/checker_image_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void FilterImagesForCheckeringForTile(std::vector<DrawImage>* images, 47 void FilterImagesForCheckeringForTile(std::vector<DrawImage>* images,
48 ImageIdFlatSet* checkered_images, 48 ImageIdFlatSet* checkered_images,
49 WhichTree tree); 49 WhichTree tree);
50 50
51 // Returns the set of images to invalidate on the sync tree. 51 // Returns the set of images to invalidate on the sync tree.
52 const ImageIdFlatSet& TakeImagesToInvalidateOnSyncTree(); 52 const ImageIdFlatSet& TakeImagesToInvalidateOnSyncTree();
53 53
54 void DidActivateSyncTree(); 54 void DidActivateSyncTree();
55 55
56 private: 56 private:
57 enum class DecodePolicy {
58 // The image can be decoded asynchronously from raster. When set, the image
59 // is always skipped during rasterization of content that includes this
60 // image until it has been decoded using the decode service.
61 ASYNC,
62 // The image has been decoded asynchronously once and should now be
63 // synchronously rasterized with the content.
64 SYNC_DECODED_ONCE,
65 // The image has been permanently vetoed from being decoded async.
66 SYNC_PERMANENT,
67 };
68
57 void DidFinishImageDecode(ImageId image_id, 69 void DidFinishImageDecode(ImageId image_id,
58 ImageController::ImageDecodeRequestId request_id, 70 ImageController::ImageDecodeRequestId request_id,
59 ImageController::ImageDecodeResult result); 71 ImageController::ImageDecodeResult result);
60 72
61 // Returns true if the decode for |image| will be deferred to the image decode 73 // Returns true if the decode for |image| will be deferred to the image decode
62 // service and it should be be skipped during raster. 74 // service and it should be be skipped during raster.
63 bool ShouldCheckerImage(const sk_sp<const SkImage>& image, 75 bool ShouldCheckerImage(const sk_sp<const SkImage>& image, WhichTree tree);
64 WhichTree tree) const;
65 76
66 void ScheduleImageDecodeIfNecessary(const sk_sp<const SkImage>& image); 77 void ScheduleImageDecodeIfNecessary(const sk_sp<const SkImage>& image);
67 78
68 ImageController* image_controller_; 79 ImageController* image_controller_;
69 CheckerImageTrackerClient* client_; 80 CheckerImageTrackerClient* client_;
70 const bool enable_checker_imaging_; 81 const bool enable_checker_imaging_;
71 82
72 // A set of images which have been decoded and are pending invalidation for 83 // A set of images which have been decoded and are pending invalidation for
73 // raster on the checkered tiles. 84 // raster on the checkered tiles.
74 ImageIdFlatSet images_pending_invalidation_; 85 ImageIdFlatSet images_pending_invalidation_;
75 86
76 // A set of images which were invalidated on the current sync tree. 87 // A set of images which were invalidated on the current sync tree.
77 ImageIdFlatSet invalidated_images_on_current_sync_tree_; 88 ImageIdFlatSet invalidated_images_on_current_sync_tree_;
78 89
79 // A set of images which are currently pending decode from the image decode 90 // A set of images which are currently pending decode from the image decode
80 // service. 91 // service.
81 // TODO(khushalsagar): This should be a queue that gets re-built each time we 92 // TODO(khushalsagar): This should be a queue that gets re-built each time we
82 // do a PrepareTiles? See crbug.com/689184. 93 // do a PrepareTiles? See crbug.com/689184.
83 ImageIdFlatSet pending_image_decodes_; 94 ImageIdFlatSet pending_image_decodes_;
84 95
85 // A set of images which have been decoded at least once from the 96 // A map of ImageId to its DecodePolicy.
86 // ImageDecodeService and should not be checkered again.
87 // TODO(khushalsagar): Limit the size of this set. 97 // TODO(khushalsagar): Limit the size of this set.
88 // TODO(khushalsagar): Plumb navigation changes here to reset this. See 98 // TODO(khushalsagar): Plumb navigation changes here to reset this. See
89 // crbug.com/693228. 99 // crbug.com/693228.
90 std::unordered_set<ImageId> images_decoded_once_; 100 std::unordered_map<ImageId, DecodePolicy> image_async_decode_state_;
91 101
92 // A map of image id to image decode request id for images to be unlocked. 102 // A map of image id to image decode request id for images to be unlocked.
93 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId> 103 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId>
94 image_id_to_decode_request_id_; 104 image_id_to_decode_request_id_;
95 105
96 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; 106 base::WeakPtrFactory<CheckerImageTracker> weak_factory_;
97 }; 107 };
98 108
99 } // namespace cc 109 } // namespace cc
100 110
101 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ 111 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/checker_image_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698