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

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

Issue 69343005: Added preliminary support for tile rasterization with Ganesh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years 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
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 <queue> 8 #include <queue>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "cc/base/ref_counted_managed.h" 15 #include "cc/base/ref_counted_managed.h"
16 #include "cc/debug/rendering_stats_instrumentation.h" 16 #include "cc/debug/rendering_stats_instrumentation.h"
17 #include "cc/resources/ganesh_rasterizer.h"
17 #include "cc/resources/managed_tile_state.h" 18 #include "cc/resources/managed_tile_state.h"
18 #include "cc/resources/memory_history.h" 19 #include "cc/resources/memory_history.h"
19 #include "cc/resources/picture_pile_impl.h" 20 #include "cc/resources/picture_pile_impl.h"
20 #include "cc/resources/prioritized_tile_set.h" 21 #include "cc/resources/prioritized_tile_set.h"
21 #include "cc/resources/raster_worker_pool.h" 22 #include "cc/resources/raster_worker_pool.h"
22 #include "cc/resources/resource_pool.h" 23 #include "cc/resources/resource_pool.h"
23 #include "cc/resources/tile.h" 24 #include "cc/resources/tile.h"
24 25
25 namespace cc { 26 namespace cc {
26 class ResourceProvider; 27 class ResourceProvider;
(...skipping 13 matching lines...) Expand all
40 size_t canceled_count; 41 size_t canceled_count;
41 }; 42 };
42 scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue( 43 scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue(
43 const RasterTaskCompletionStats& stats); 44 const RasterTaskCompletionStats& stats);
44 45
45 // This class manages tiles, deciding which should get rasterized and which 46 // This class manages tiles, deciding which should get rasterized and which
46 // should no longer have any memory assigned to them. Tile objects are "owned" 47 // should no longer have any memory assigned to them. Tile objects are "owned"
47 // by layers; they automatically register with the manager when they are 48 // by layers; they automatically register with the manager when they are
48 // created, and unregister from the manager when they are deleted. 49 // created, and unregister from the manager when they are deleted.
49 class CC_EXPORT TileManager : public RasterWorkerPoolClient, 50 class CC_EXPORT TileManager : public RasterWorkerPoolClient,
51 public GaneshRasterizerClient,
50 public RefCountedManager<Tile> { 52 public RefCountedManager<Tile> {
51 public: 53 public:
52 static scoped_ptr<TileManager> Create( 54 static scoped_ptr<TileManager> Create(
53 TileManagerClient* client, 55 TileManagerClient* client,
54 ResourceProvider* resource_provider, 56 ResourceProvider* resource_provider,
57 ContextProvider* context_provider,
55 size_t num_raster_threads, 58 size_t num_raster_threads,
56 RenderingStatsInstrumentation* rendering_stats_instrumentation, 59 RenderingStatsInstrumentation* rendering_stats_instrumentation,
60 bool use_ganesh,
reveman 2013/11/24 21:56:57 how do we plan to mark layers/tiles as candidates
slavi 2013/11/25 23:13:14 We need a heuristic in tile manager (search TODO(s
enne (OOO) 2013/11/25 23:14:10 I would really not like to have a global mode flag
57 bool use_map_image, 61 bool use_map_image,
58 size_t max_transfer_buffer_usage_bytes, 62 size_t max_transfer_buffer_usage_bytes,
59 size_t max_raster_usage_bytes); 63 size_t max_raster_usage_bytes);
60 virtual ~TileManager(); 64 virtual ~TileManager();
61 65
62 void ManageTiles(const GlobalStateThatImpactsTilePriority& state); 66 void ManageTiles(const GlobalStateThatImpactsTilePriority& state);
63 67
64 // Returns true when visible tiles have been initialized. 68 // Returns true when visible tiles have been initialized.
65 bool UpdateVisibleTiles(); 69 bool UpdateVisibleTiles();
66 70
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (state != global_state_) { 112 if (state != global_state_) {
109 global_state_ = state; 113 global_state_ = state;
110 prioritized_tiles_dirty_ = true; 114 prioritized_tiles_dirty_ = true;
111 resource_pool_->SetResourceUsageLimits( 115 resource_pool_->SetResourceUsageLimits(
112 global_state_.memory_limit_in_bytes, 116 global_state_.memory_limit_in_bytes,
113 global_state_.unused_memory_limit_in_bytes, 117 global_state_.unused_memory_limit_in_bytes,
114 global_state_.num_resources_limit); 118 global_state_.num_resources_limit);
115 } 119 }
116 } 120 }
117 121
122 // GaneshRasterizerClient interface
123 virtual void OnGaneshRasterTaskCompleted(
124 Tile* tile, scoped_ptr<ResourcePool::Resource> resource,
125 bool was_canceled) OVERRIDE;
126
118 protected: 127 protected:
119 TileManager(TileManagerClient* client, 128 TileManager(TileManagerClient* client,
120 ResourceProvider* resource_provider, 129 ResourceProvider* resource_provider,
121 scoped_ptr<RasterWorkerPool> raster_worker_pool, 130 scoped_ptr<RasterWorkerPool> raster_worker_pool,
131 scoped_ptr<GaneshRasterizer> ganesh_rasterizer,
122 size_t num_raster_threads, 132 size_t num_raster_threads,
123 size_t max_raster_usage_bytes, 133 size_t max_raster_usage_bytes,
124 RenderingStatsInstrumentation* rendering_stats_instrumentation); 134 RenderingStatsInstrumentation* rendering_stats_instrumentation);
125 135
126 // Methods called by Tile 136 // Methods called by Tile
127 friend class Tile; 137 friend class Tile;
128 void DidChangeTilePriority(Tile* tile); 138 void DidChangeTilePriority(Tile* tile);
129 139
130 void CleanUpReleasedTiles(); 140 void CleanUpReleasedTiles();
131 141
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 raster_worker_pool_->GetResourceFormat()); 177 raster_worker_pool_->GetResourceFormat());
168 } 178 }
169 179
170 RasterMode DetermineRasterMode(const Tile* tile) const; 180 RasterMode DetermineRasterMode(const Tile* tile) const;
171 void FreeResourceForTile(Tile* tile, RasterMode mode); 181 void FreeResourceForTile(Tile* tile, RasterMode mode);
172 void FreeResourcesForTile(Tile* tile); 182 void FreeResourcesForTile(Tile* tile);
173 void FreeUnusedResourcesForTile(Tile* tile); 183 void FreeUnusedResourcesForTile(Tile* tile);
174 RasterWorkerPool::Task CreateImageDecodeTask( 184 RasterWorkerPool::Task CreateImageDecodeTask(
175 Tile* tile, skia::LazyPixelRef* pixel_ref); 185 Tile* tile, skia::LazyPixelRef* pixel_ref);
176 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); 186 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile);
187 void CreateGaneshRasterTask(Tile* tile);
177 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; 188 scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const;
178 void UpdatePrioritizedTileSetIfNeeded(); 189 void UpdatePrioritizedTileSetIfNeeded();
179 190
180 TileManagerClient* client_; 191 TileManagerClient* client_;
181 scoped_ptr<ResourcePool> resource_pool_; 192 scoped_ptr<ResourcePool> resource_pool_;
182 scoped_ptr<RasterWorkerPool> raster_worker_pool_; 193 scoped_ptr<RasterWorkerPool> raster_worker_pool_;
194 scoped_ptr<GaneshRasterizer> ganesh_rasterizer_;
183 GlobalStateThatImpactsTilePriority global_state_; 195 GlobalStateThatImpactsTilePriority global_state_;
184 196
185 typedef base::hash_map<Tile::Id, Tile*> TileMap; 197 typedef base::hash_map<Tile::Id, Tile*> TileMap;
186 TileMap tiles_; 198 TileMap tiles_;
187 199
188 PrioritizedTileSet prioritized_tiles_; 200 PrioritizedTileSet prioritized_tiles_;
189 bool prioritized_tiles_dirty_; 201 bool prioritized_tiles_dirty_;
190 202
191 bool all_tiles_that_need_to_be_rasterized_have_memory_; 203 bool all_tiles_that_need_to_be_rasterized_have_memory_;
192 bool all_tiles_required_for_activation_have_memory_; 204 bool all_tiles_required_for_activation_have_memory_;
(...skipping 23 matching lines...) Expand all
216 RasterTaskCompletionStats update_visible_tiles_stats_; 228 RasterTaskCompletionStats update_visible_tiles_stats_;
217 229
218 std::vector<Tile*> released_tiles_; 230 std::vector<Tile*> released_tiles_;
219 231
220 DISALLOW_COPY_AND_ASSIGN(TileManager); 232 DISALLOW_COPY_AND_ASSIGN(TileManager);
221 }; 233 };
222 234
223 } // namespace cc 235 } // namespace cc
224 236
225 #endif // CC_RESOURCES_TILE_MANAGER_H_ 237 #endif // CC_RESOURCES_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698