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

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

Issue 2726343004: cc: Optimize decode scheduling for checker-images. (Closed)
Patch Set: addressed comments Created 3 years, 9 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') | cc/tiles/checker_image_tracker.cc » ('J')
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // The entries remaining in |images| are for images for which a cached decode 44 // 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 45 // from the image decode service is available, or which must be decoded before
46 // before this tile can be rasterized. 46 // before this tile can be rasterized.
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 // Resets any pending image decode requests that have not been scheduled for
55 // decode already. Note that calling this means that tiles which have already
56 // been checker-imaged need to be filtered on the tracker again to
57 // re-rasterize them.
58 void ResetImageDecodeQueue();
59
54 void DidActivateSyncTree(); 60 void DidActivateSyncTree();
55 61
56 private: 62 private:
57 void DidFinishImageDecode(ImageId image_id, 63 void DidFinishImageDecode(ImageId image_id,
58 ImageController::ImageDecodeRequestId request_id, 64 ImageController::ImageDecodeRequestId request_id,
59 ImageController::ImageDecodeResult result); 65 ImageController::ImageDecodeResult result);
60 66
61 // Returns true if the decode for |image| will be deferred to the image decode 67 // Returns true if the decode for |image| will be deferred to the image decode
62 // service and it should be be skipped during raster. 68 // service and it should be be skipped during raster.
63 bool ShouldCheckerImage(const sk_sp<const SkImage>& image, 69 bool ShouldCheckerImage(const sk_sp<const SkImage>& image,
64 WhichTree tree) const; 70 WhichTree tree) const;
65 71
66 void ScheduleImageDecodeIfNecessary(const sk_sp<const SkImage>& image); 72 void ScheduleImageDecodeIfNecessary(const sk_sp<const SkImage>& image);
67 73
74 // Called when the next request in the |image_decode_queue_| should be
75 // scheduled with the image decode service.
76 void ScheduleNextImageDecode();
77
68 ImageController* image_controller_; 78 ImageController* image_controller_;
69 CheckerImageTrackerClient* client_; 79 CheckerImageTrackerClient* client_;
70 const bool enable_checker_imaging_; 80 const bool enable_checker_imaging_;
71 81
72 // A set of images which have been decoded and are pending invalidation for 82 // A set of images which have been decoded and are pending invalidation for
73 // raster on the checkered tiles. 83 // raster on the checkered tiles.
74 ImageIdFlatSet images_pending_invalidation_; 84 ImageIdFlatSet images_pending_invalidation_;
75 85
76 // A set of images which were invalidated on the current sync tree. 86 // A set of images which were invalidated on the current sync tree.
77 ImageIdFlatSet invalidated_images_on_current_sync_tree_; 87 ImageIdFlatSet invalidated_images_on_current_sync_tree_;
78 88
79 // A set of images which are currently pending decode from the image decode 89 // 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_; 90 ImageIdFlatSet pending_image_decodes_;
84 91
92 // The queue of images pending decode. We maintain a queue to ensure that the
93 // order in which images are decoded is aligned with the priority of the tiles
94 // dependent on these images.
95 // The first image in this queue, if any, is the currently outstanding decode
96 // request given to the queue.
97 std::list<sk_sp<const SkImage>> image_decode_request_queue_;
vmpstr 2017/03/07 19:25:08 Can you write a cc_perftest for repeated schedules
Khushal 2017/03/13 20:35:08 I guess not necessary anymore. We iterate through
98
85 // A set of images which have been decoded at least once from the 99 // A set of images which have been decoded at least once from the
86 // ImageDecodeService and should not be checkered again. 100 // ImageDecodeService and should not be checkered again.
87 // TODO(khushalsagar): Limit the size of this set. 101 // TODO(khushalsagar): Limit the size of this set.
88 // TODO(khushalsagar): Plumb navigation changes here to reset this. See 102 // TODO(khushalsagar): Plumb navigation changes here to reset this. See
89 // crbug.com/693228. 103 // crbug.com/693228.
90 std::unordered_set<ImageId> images_decoded_once_; 104 std::unordered_set<ImageId> images_decoded_once_;
91 105
92 // A map of image id to image decode request id for images to be unlocked. 106 // A map of image id to image decode request id for images to be unlocked.
93 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId> 107 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId>
94 image_id_to_decode_request_id_; 108 image_id_to_decode_request_id_;
95 109
96 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; 110 base::WeakPtrFactory<CheckerImageTracker> weak_factory_;
97 }; 111 };
98 112
99 } // namespace cc 113 } // namespace cc
100 114
101 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ 115 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/checker_image_tracker.cc » ('j') | cc/tiles/checker_image_tracker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698