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

Side by Side Diff: cc/resources/tile_manager.h

Issue 895853003: Update from https://crrev.com/314320 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/tile_manager.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_RESOURCES_TILE_MANAGER_H_ 5 #ifndef CC_RESOURCES_TILE_MANAGER_H_
6 #define CC_RESOURCES_TILE_MANAGER_H_ 6 #define CC_RESOURCES_TILE_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 } 33 }
34 34
35 namespace cc { 35 namespace cc {
36 class PictureLayerImpl; 36 class PictureLayerImpl;
37 class Rasterizer; 37 class Rasterizer;
38 class ResourceProvider; 38 class ResourceProvider;
39 39
40 class CC_EXPORT TileManagerClient { 40 class CC_EXPORT TileManagerClient {
41 public: 41 public:
42 // Returns the set of layers that the tile manager should consider for raster.
43 // TODO(vmpstr): Change the way we determine if we are ready to activate, so
44 // that this can be removed.
45 virtual const std::vector<PictureLayerImpl*>& GetPictureLayers() const = 0;
46
47 // Called when all tiles marked as required for activation are ready to draw. 42 // Called when all tiles marked as required for activation are ready to draw.
48 virtual void NotifyReadyToActivate() = 0; 43 virtual void NotifyReadyToActivate() = 0;
49 44
50 // Called when all tiles marked as required for draw are ready to draw. 45 // Called when all tiles marked as required for draw are ready to draw.
51 virtual void NotifyReadyToDraw() = 0; 46 virtual void NotifyReadyToDraw() = 0;
52 47
53 // Called when the visible representation of a tile might have changed. Some 48 // Called when the visible representation of a tile might have changed. Some
54 // examples are: 49 // examples are:
55 // - Tile version initialized. 50 // - Tile version initialized.
56 // - Tile resources freed. 51 // - Tile resources freed.
57 // - Tile marked for on-demand raster. 52 // - Tile marked for on-demand raster.
58 virtual void NotifyTileStateChanged(const Tile* tile) = 0; 53 virtual void NotifyTileStateChanged(const Tile* tile) = 0;
59 54
60 // Given an empty raster tile priority queue, this will build a priority queue 55 // Given an empty raster tile priority queue, this will build a priority queue
61 // that will return tiles in order in which they should be rasterized. 56 // that will return tiles in order in which they should be rasterized.
62 // Note if the queue was previous built, Reset must be called on it. 57 // Note if the queue was previous built, Reset must be called on it.
63 virtual scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue( 58 virtual scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue(
64 TreePriority tree_priority, 59 TreePriority tree_priority,
65 RasterTilePriorityQueue::Type type) = 0; 60 RasterTilePriorityQueue::Type type) = 0;
66 61
67 // Given an empty eviction tile priority queue, this will build a priority 62 // Given an empty eviction tile priority queue, this will build a priority
68 // queue that will return tiles in order in which they should be evicted. 63 // queue that will return tiles in order in which they should be evicted.
69 // Note if the queue was previous built, Reset must be called on it. 64 // Note if the queue was previous built, Reset must be called on it.
70 virtual scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( 65 virtual scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue(
71 TreePriority tree_priority) = 0; 66 TreePriority tree_priority) = 0;
72 67
68 // Informs the client that due to the currently rasterizing (or scheduled to
69 // be rasterized) tiles, we will be in a position that will likely require a
70 // draw. This can be used to preemptively start a frame.
71 virtual void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) = 0;
72
73 protected: 73 protected:
74 virtual ~TileManagerClient() {} 74 virtual ~TileManagerClient() {}
75 }; 75 };
76 76
77 struct RasterTaskCompletionStats { 77 struct RasterTaskCompletionStats {
78 RasterTaskCompletionStats(); 78 RasterTaskCompletionStats();
79 79
80 size_t completed_count; 80 size_t completed_count;
81 size_t canceled_count; 81 size_t canceled_count;
82 }; 82 };
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 ++it) { 169 ++it) {
170 tiles.push_back(it->second); 170 tiles.push_back(it->second);
171 } 171 }
172 return tiles; 172 return tiles;
173 } 173 }
174 174
175 void SetScheduledRasterTaskLimitForTesting(size_t limit) { 175 void SetScheduledRasterTaskLimitForTesting(size_t limit) {
176 scheduled_raster_task_limit_ = limit; 176 scheduled_raster_task_limit_ = limit;
177 } 177 }
178 178
179 bool IsReadyToActivate() const;
180 bool IsReadyToDraw() const;
181
179 protected: 182 protected:
180 TileManager(TileManagerClient* client, 183 TileManager(TileManagerClient* client,
181 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 184 const scoped_refptr<base::SequencedTaskRunner>& task_runner,
182 ResourcePool* resource_pool, 185 ResourcePool* resource_pool,
183 TileTaskRunner* tile_task_runner, 186 TileTaskRunner* tile_task_runner,
184 Rasterizer* rasterizer, 187 Rasterizer* rasterizer,
185 size_t scheduled_raster_task_limit); 188 size_t scheduled_raster_task_limit);
186 189
187 void FreeResourcesForReleasedTiles(); 190 void FreeResourcesForReleasedTiles();
188 void CleanUpReleasedTiles(); 191 void CleanUpReleasedTiles();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, 255 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue,
253 const MemoryUsage& limit, 256 const MemoryUsage& limit,
254 MemoryUsage* usage); 257 MemoryUsage* usage);
255 scoped_ptr<EvictionTilePriorityQueue> 258 scoped_ptr<EvictionTilePriorityQueue>
256 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit( 259 FreeTileResourcesWithLowerPriorityUntilUsageIsWithinLimit(
257 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue, 260 scoped_ptr<EvictionTilePriorityQueue> eviction_priority_queue,
258 const MemoryUsage& limit, 261 const MemoryUsage& limit,
259 const TilePriority& oother_priority, 262 const TilePriority& oother_priority,
260 MemoryUsage* usage); 263 MemoryUsage* usage);
261 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority); 264 bool TilePriorityViolatesMemoryPolicy(const TilePriority& priority);
262 bool IsReadyToActivate() const; 265 bool AreRequiredTilesReadyToDraw(RasterTilePriorityQueue::Type type) const;
263 bool IsReadyToDraw() const;
264 void NotifyReadyToActivate(); 266 void NotifyReadyToActivate();
265 void NotifyReadyToDraw(); 267 void NotifyReadyToDraw();
266 void CheckIfReadyToActivate(); 268 void CheckIfReadyToActivate();
267 void CheckIfReadyToDraw(); 269 void CheckIfReadyToDraw();
268 void CheckIfMoreTilesNeedToBePrepared(); 270 void CheckIfMoreTilesNeedToBePrepared();
269 271
270 TileManagerClient* client_; 272 TileManagerClient* client_;
271 scoped_refptr<base::SequencedTaskRunner> task_runner_; 273 scoped_refptr<base::SequencedTaskRunner> task_runner_;
272 ResourcePool* resource_pool_; 274 ResourcePool* resource_pool_;
273 TileTaskRunner* tile_task_runner_; 275 TileTaskRunner* tile_task_runner_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 311
310 bool did_notify_ready_to_activate_; 312 bool did_notify_ready_to_activate_;
311 bool did_notify_ready_to_draw_; 313 bool did_notify_ready_to_draw_;
312 314
313 DISALLOW_COPY_AND_ASSIGN(TileManager); 315 DISALLOW_COPY_AND_ASSIGN(TileManager);
314 }; 316 };
315 317
316 } // namespace cc 318 } // namespace cc
317 319
318 #endif // CC_RESOURCES_TILE_MANAGER_H_ 320 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698