OLD | NEW |
---|---|
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/hash_tables.h" | 12 #include "base/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/debug/rendering_stats_instrumentation.h" | 15 #include "cc/debug/rendering_stats_instrumentation.h" |
16 #include "cc/resources/memory_history.h" | 16 #include "cc/resources/memory_history.h" |
17 #include "cc/resources/picture_pile_impl.h" | 17 #include "cc/resources/picture_pile_impl.h" |
18 #include "cc/resources/raster_worker_pool.h" | 18 #include "cc/resources/raster_worker_pool.h" |
19 #include "cc/resources/resource_pool.h" | 19 #include "cc/resources/resource_pool.h" |
20 #include "cc/resources/tile_priority.h" | 20 #include "cc/resources/tile_priority.h" |
21 | 21 |
22 namespace cc { | 22 namespace cc { |
23 class ResourceProvider; | 23 class ResourceProvider; |
24 class Tile; | 24 class Tile; |
25 class TileVersion; | 25 class TileVersion; |
26 | 26 |
27 // Low quality implies no lcd test; | |
28 // high quality implies lcd text. | |
29 enum TileRasterMode { | |
30 LOW_QUALITY_RASTER_MODE = 0, | |
31 HIGH_QUALITY_NO_LCD_RASTER_MODE = 1, | |
32 HIGH_QUALITY_RASTER_MODE = 2, | |
reveman
2013/06/05 18:01:32
Maybe reverse the order of these so you can iterat
vmpstr
2013/06/06 01:54:20
Done.
| |
33 NUM_RASTER_MODES | |
reveman
2013/06/05 18:01:32
"NUM_RASTER_MODES = 3" to be consistent with TileM
vmpstr
2013/06/06 01:54:20
Done.
| |
34 }; | |
35 | |
27 class CC_EXPORT TileManagerClient { | 36 class CC_EXPORT TileManagerClient { |
28 public: | 37 public: |
29 virtual void ScheduleManageTiles() = 0; | 38 virtual void ScheduleManageTiles() = 0; |
30 virtual void DidInitializeVisibleTile() = 0; | 39 virtual void DidInitializeVisibleTile() = 0; |
31 virtual bool | 40 virtual bool |
32 ShouldForceTileUploadsRequiredForActivationToComplete() const = 0; | 41 ShouldForceTileUploadsRequiredForActivationToComplete() const = 0; |
33 | 42 |
34 protected: | 43 protected: |
35 virtual ~TileManagerClient() {} | 44 virtual ~TileManagerClient() {} |
36 }; | 45 }; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 | 126 |
118 private: | 127 private: |
119 // Data that is passed to raster tasks. | 128 // Data that is passed to raster tasks. |
120 struct RasterTaskMetadata { | 129 struct RasterTaskMetadata { |
121 scoped_ptr<base::Value> AsValue() const; | 130 scoped_ptr<base::Value> AsValue() const; |
122 bool is_tile_in_pending_tree_now_bin; | 131 bool is_tile_in_pending_tree_now_bin; |
123 TileResolution tile_resolution; | 132 TileResolution tile_resolution; |
124 int layer_id; | 133 int layer_id; |
125 const void* tile_id; | 134 const void* tile_id; |
126 int source_frame_number; | 135 int source_frame_number; |
136 TileRasterMode raster_mode; | |
127 }; | 137 }; |
128 | 138 |
129 void AssignBinsToTiles(); | 139 void AssignBinsToTiles(); |
130 void SortTiles(); | 140 void SortTiles(); |
141 TileRasterMode DetermineRasterMode(const Tile* tile) const; | |
131 void AssignGpuMemoryToTiles(); | 142 void AssignGpuMemoryToTiles(); |
132 void FreeResourcesForTile(Tile* tile); | 143 void FreeResourcesForTile(Tile* tile); |
144 void FreeUnusedResourcesForTile(Tile* tile); | |
133 void ScheduleManageTiles() { | 145 void ScheduleManageTiles() { |
134 if (manage_tiles_pending_) | 146 if (manage_tiles_pending_) |
135 return; | 147 return; |
136 client_->ScheduleManageTiles(); | 148 client_->ScheduleManageTiles(); |
137 manage_tiles_pending_ = true; | 149 manage_tiles_pending_ = true; |
138 } | 150 } |
139 RasterWorkerPool::Task CreateImageDecodeTask( | 151 RasterWorkerPool::Task CreateImageDecodeTask( |
140 Tile* tile, skia::LazyPixelRef* pixel_ref); | 152 Tile* tile, skia::LazyPixelRef* pixel_ref); |
141 void OnImageDecodeTaskCompleted( | 153 void OnImageDecodeTaskCompleted( |
142 scoped_refptr<Tile> tile, | 154 scoped_refptr<Tile> tile, |
143 uint32_t pixel_ref_id); | 155 uint32_t pixel_ref_id); |
144 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; | 156 RasterTaskMetadata GetRasterTaskMetadata(const Tile& tile) const; |
145 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); | 157 RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); |
146 void OnRasterTaskCompleted( | 158 void OnRasterTaskCompleted( |
147 scoped_refptr<Tile> tile, | 159 scoped_refptr<Tile> tile, |
148 scoped_ptr<ResourcePool::Resource> resource, | 160 scoped_ptr<ResourcePool::Resource> resource, |
149 PicturePileImpl::Analysis* analysis, | 161 PicturePileImpl::Analysis* analysis, |
162 TileRasterMode raster_mode, | |
150 bool was_canceled); | 163 bool was_canceled); |
151 void DidFinishTileInitialization(Tile* tile); | 164 void DidFinishTileInitialization(Tile* tile); |
152 void DidTileTreeBinChange(Tile* tile, | 165 void DidTileTreeBinChange(Tile* tile, |
153 TileManagerBin new_tree_bin, | 166 TileManagerBin new_tree_bin, |
154 WhichTree tree); | 167 WhichTree tree); |
155 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; | 168 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; |
156 void AddRequiredTileForActivation(Tile* tile); | 169 void AddRequiredTileForActivation(Tile* tile); |
157 | 170 |
158 static void RunImageDecodeTask( | 171 static void RunImageDecodeTask( |
159 skia::LazyPixelRef* pixel_ref, | 172 skia::LazyPixelRef* pixel_ref, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 | 217 |
205 bool use_color_estimator_; | 218 bool use_color_estimator_; |
206 bool did_initialize_visible_tile_; | 219 bool did_initialize_visible_tile_; |
207 | 220 |
208 DISALLOW_COPY_AND_ASSIGN(TileManager); | 221 DISALLOW_COPY_AND_ASSIGN(TileManager); |
209 }; | 222 }; |
210 | 223 |
211 } // namespace cc | 224 } // namespace cc |
212 | 225 |
213 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 226 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |