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> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // by layers; they automatically register with the manager when they are | 46 // by layers; they automatically register with the manager when they are |
47 // created, and unregister from the manager when they are deleted. | 47 // created, and unregister from the manager when they are deleted. |
48 class CC_EXPORT TileManager : public RasterWorkerPoolClient { | 48 class CC_EXPORT TileManager : public RasterWorkerPoolClient { |
49 public: | 49 public: |
50 static scoped_ptr<TileManager> Create( | 50 static scoped_ptr<TileManager> Create( |
51 TileManagerClient* client, | 51 TileManagerClient* client, |
52 ResourceProvider* resource_provider, | 52 ResourceProvider* resource_provider, |
53 size_t num_raster_threads, | 53 size_t num_raster_threads, |
54 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 54 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
55 bool use_map_image, | 55 bool use_map_image, |
56 size_t max_transfer_buffer_usage_bytes); | 56 size_t max_transfer_buffer_usage_bytes, |
| 57 bool use_rgba_4444_tiles); |
57 virtual ~TileManager(); | 58 virtual ~TileManager(); |
58 | 59 |
59 const GlobalStateThatImpactsTilePriority& GlobalState() const { | 60 const GlobalStateThatImpactsTilePriority& GlobalState() const { |
60 return global_state_; | 61 return global_state_; |
61 } | 62 } |
62 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 63 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
63 | 64 |
64 void ManageTiles(); | 65 void ManageTiles(); |
65 | 66 |
66 // Returns true when visible tiles have been initialized. | 67 // Returns true when visible tiles have been initialized. |
(...skipping 14 matching lines...) Expand all Loading... |
81 const std::vector<Tile*>& tiles, | 82 const std::vector<Tile*>& tiles, |
82 ResourceProvider* resource_provider) { | 83 ResourceProvider* resource_provider) { |
83 for (size_t i = 0; i < tiles.size(); ++i) { | 84 for (size_t i = 0; i < tiles.size(); ++i) { |
84 ManagedTileState& mts = tiles[i]->managed_state(); | 85 ManagedTileState& mts = tiles[i]->managed_state(); |
85 ManagedTileState::TileVersion& tile_version = | 86 ManagedTileState::TileVersion& tile_version = |
86 mts.tile_versions[HIGH_QUALITY_NO_LCD_RASTER_MODE]; | 87 mts.tile_versions[HIGH_QUALITY_NO_LCD_RASTER_MODE]; |
87 | 88 |
88 tile_version.resource_ = make_scoped_ptr( | 89 tile_version.resource_ = make_scoped_ptr( |
89 new ResourcePool::Resource(resource_provider, | 90 new ResourcePool::Resource(resource_provider, |
90 gfx::Size(1, 1), | 91 gfx::Size(1, 1), |
91 resource_provider->best_texture_format())); | 92 resource_provider->best_texture_format(), |
| 93 ResourceProvider::RGBA_8888)); |
92 | 94 |
93 bytes_releasable_ += tiles[i]->bytes_consumed_if_allocated(); | 95 bytes_releasable_ += tiles[i]->bytes_consumed_if_allocated(); |
94 ++resources_releasable_; | 96 ++resources_releasable_; |
95 } | 97 } |
96 } | 98 } |
97 RasterWorkerPool* RasterWorkerPoolForTesting() { | 99 RasterWorkerPool* RasterWorkerPoolForTesting() { |
98 return raster_worker_pool_.get(); | 100 return raster_worker_pool_.get(); |
99 } | 101 } |
100 | 102 |
101 protected: | 103 protected: |
102 TileManager(TileManagerClient* client, | 104 TileManager(TileManagerClient* client, |
103 ResourceProvider* resource_provider, | 105 ResourceProvider* resource_provider, |
104 scoped_ptr<RasterWorkerPool> raster_worker_pool, | 106 scoped_ptr<RasterWorkerPool> raster_worker_pool, |
105 size_t num_raster_threads, | 107 size_t num_raster_threads, |
106 RenderingStatsInstrumentation* rendering_stats_instrumentation); | 108 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 109 ResourceProvider::TextureType texture_type); |
107 | 110 |
108 // Methods called by Tile | 111 // Methods called by Tile |
109 friend class Tile; | 112 friend class Tile; |
110 void RegisterTile(Tile* tile); | 113 void RegisterTile(Tile* tile); |
111 void UnregisterTile(Tile* tile); | 114 void UnregisterTile(Tile* tile); |
112 void DidChangeTilePriority(Tile* tile); | 115 void DidChangeTilePriority(Tile* tile); |
113 | 116 |
114 // Overriden from RasterWorkerPoolClient: | 117 // Overriden from RasterWorkerPoolClient: |
115 virtual bool ShouldForceTasksRequiredForActivationToComplete() const | 118 virtual bool ShouldForceTasksRequiredForActivationToComplete() const |
116 OVERRIDE; | 119 OVERRIDE; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 bool did_initialize_visible_tile_; | 179 bool did_initialize_visible_tile_; |
177 | 180 |
178 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; | 181 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; |
179 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; | 182 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; |
180 LayerPixelRefTaskMap image_decode_tasks_; | 183 LayerPixelRefTaskMap image_decode_tasks_; |
181 | 184 |
182 typedef base::hash_map<int, int> LayerCountMap; | 185 typedef base::hash_map<int, int> LayerCountMap; |
183 LayerCountMap used_layer_counts_; | 186 LayerCountMap used_layer_counts_; |
184 | 187 |
185 RasterTaskCompletionStats update_visible_tiles_stats_; | 188 RasterTaskCompletionStats update_visible_tiles_stats_; |
| 189 ResourceProvider::TextureType texture_type_; |
186 | 190 |
187 DISALLOW_COPY_AND_ASSIGN(TileManager); | 191 DISALLOW_COPY_AND_ASSIGN(TileManager); |
188 }; | 192 }; |
189 | 193 |
190 } // namespace cc | 194 } // namespace cc |
191 | 195 |
192 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 196 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
OLD | NEW |