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

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

Issue 2668873002: cc: Add checker-imaging support to TileManager. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
vmpstr 2017/02/03 23:42:32 2017
Khushal 2017/02/07 00:25:32 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_TILES_CHECKER_IMAGE_TRACKER_H_
6 #define CC_TILES_CHECKER_IMAGE_TRACKER_H_
7
8 #include <unordered_map>
9 #include <unordered_set>
10 #include <vector>
11
12 #include "cc/playback/image_id.h"
13 #include "cc/tiles/image_controller.h"
14 #include "third_party/skia/include/core/SkImage.h"
15
16 namespace cc {
17 class LayerTreeImpl;
18 class PrioritizedTile;
19
20 class CheckerImageTrackerClient {
21 public:
22 virtual ~CheckerImageTrackerClient() {}
23
24 virtual void NeedsInvalidationForCheckerImagedTiles() = 0;
25 };
26
27 class CheckerImageTracker {
28 public:
29 CheckerImageTracker(ImageController* image_controller,
30 CheckerImageTrackerClient* client,
31 bool enable_checker_imaging);
32 ~CheckerImageTracker();
33
34 // For the given |prioritized_tile|, populates |images| with the set of images
35 // that must be decoded before this tile can be rastered.
36 // |checkered_images| will be populated with set of images which will be
37 // decoded using the Image Decode Service and must be skipped during
38 // rasterization of this tile.
39 void FilterImagesForCheckeringForTile(
40 const PrioritizedTile& prioritized_tile,
41 std::vector<DrawImage>* images,
42 std::unordered_set<ImageId>* checkered_images);
43
44 // Invalidates the region for decoded images on the sync tree.
45 void AddInvalidationForCheckerImages(LayerTreeImpl* sync_tree);
46
47 void DidActivateSyncTree();
48
49 private:
50 void DidFinishImageDecode(ImageId image_id,
51 ImageController::ImageDecodeRequestId request_id);
52
53 // Returns true if the decode for |image| will be deferred to the image decode
54 // service and it should be be skipped during raster.
55 bool AnalyzeImageForCheckeringAndScheduleDecodeIfNecessary(
56 const sk_sp<const SkImage> image,
57 WhichTree tree);
58
59 ImageController* image_controller_;
60 CheckerImageTrackerClient* client_;
61 const bool enable_checker_imaging_;
62
63 using ImageIdSet = std::unordered_set<ImageId>;
vmpstr 2017/02/03 23:42:32 I wonder if we should just use a vector. It might
Khushal 2017/02/07 00:25:32 The set was more for the look up cost. The |images
64
65 // A set of images which have been decoded and are pending invalidation for
66 // raster on the checkered tiles.
67 ImageIdSet images_pending_invalidation_;
68
69 // A set of images which were invalidated on the current sync tree.
70 ImageIdSet images_invalidated_on_current_sync_tree_;
vmpstr 2017/02/03 23:42:32 nit: invalidated_images_
Khushal 2017/02/07 00:25:32 Done.
71
72 // A set of images which are currently pending decode from the image decode
73 // service.
74 // TODO(khushalsagar): This should be a queue that gets re-built each time we
vmpstr 2017/02/03 23:42:32 We can file a bug as a follow up for this.
Khushal 2017/02/07 00:25:32 Done.
75 // do a PrepareTiles?
76 ImageIdSet pending_image_decodes_;
77
78 // A set of images which have been decoded at least once from the
79 // ImageDecodeService and should not be checkered again.
80 ImageIdSet images_decoded_once_;
81
82 // A map of image id to image decode request id for images to be unlocked.
83 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId>
84 image_id_to_decode_request_id_;
85
86 base::WeakPtrFactory<CheckerImageTracker> weak_factory_;
87 };
88
89 } // namespace cc
90
91 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698