| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // This class manages tiles, deciding which should get rasterized and which | 57 // This class manages tiles, deciding which should get rasterized and which |
| 58 // should no longer have any memory assigned to them. Tile objects are "owned" | 58 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 59 // by layers; they automatically register with the manager when they are | 59 // by layers; they automatically register with the manager when they are |
| 60 // created, and unregister from the manager when they are deleted. | 60 // created, and unregister from the manager when they are deleted. |
| 61 class CC_EXPORT TileManager : public RasterWorkerPoolClient { | 61 class CC_EXPORT TileManager : public RasterWorkerPoolClient { |
| 62 public: | 62 public: |
| 63 static scoped_ptr<TileManager> Create( | 63 static scoped_ptr<TileManager> Create( |
| 64 TileManagerClient* client, | 64 TileManagerClient* client, |
| 65 ResourceProvider* resource_provider, | 65 ResourceProvider* resource_provider, |
| 66 size_t num_raster_threads, | 66 size_t num_raster_threads, |
| 67 bool use_color_estimator, | |
| 68 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 67 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 69 bool use_map_image); | 68 bool use_map_image); |
| 70 virtual ~TileManager(); | 69 virtual ~TileManager(); |
| 71 | 70 |
| 72 const GlobalStateThatImpactsTilePriority& GlobalState() const { | 71 const GlobalStateThatImpactsTilePriority& GlobalState() const { |
| 73 return global_state_; | 72 return global_state_; |
| 74 } | 73 } |
| 75 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 74 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
| 76 | 75 |
| 77 void ManageTiles(); | 76 void ManageTiles(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 89 | 88 |
| 90 bool AreTilesRequiredForActivationReady() const { | 89 bool AreTilesRequiredForActivationReady() const { |
| 91 return tiles_that_need_to_be_initialized_for_activation_.empty(); | 90 return tiles_that_need_to_be_initialized_for_activation_.empty(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 protected: | 93 protected: |
| 95 TileManager(TileManagerClient* client, | 94 TileManager(TileManagerClient* client, |
| 96 ResourceProvider* resource_provider, | 95 ResourceProvider* resource_provider, |
| 97 scoped_ptr<RasterWorkerPool> raster_worker_pool, | 96 scoped_ptr<RasterWorkerPool> raster_worker_pool, |
| 98 size_t num_raster_threads, | 97 size_t num_raster_threads, |
| 99 bool use_color_estimator, | |
| 100 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 98 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 101 GLenum texture_format); | 99 GLenum texture_format); |
| 102 | 100 |
| 103 // Methods called by Tile | 101 // Methods called by Tile |
| 104 friend class Tile; | 102 friend class Tile; |
| 105 void RegisterTile(Tile* tile); | 103 void RegisterTile(Tile* tile); |
| 106 void UnregisterTile(Tile* tile); | 104 void UnregisterTile(Tile* tile); |
| 107 | 105 |
| 108 // Overriden from RasterWorkerPoolClient: | 106 // Overriden from RasterWorkerPoolClient: |
| 109 virtual bool ShouldForceTasksRequiredForActivationToComplete() const | 107 virtual bool ShouldForceTasksRequiredForActivationToComplete() const |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 TileVector tiles_; | 150 TileVector tiles_; |
| 153 TileVector tiles_that_need_to_be_rasterized_; | 151 TileVector tiles_that_need_to_be_rasterized_; |
| 154 typedef std::set<Tile*> TileSet; | 152 typedef std::set<Tile*> TileSet; |
| 155 TileSet tiles_that_need_to_be_initialized_for_activation_; | 153 TileSet tiles_that_need_to_be_initialized_for_activation_; |
| 156 | 154 |
| 157 bool ever_exceeded_memory_budget_; | 155 bool ever_exceeded_memory_budget_; |
| 158 MemoryHistory::Entry memory_stats_from_last_assign_; | 156 MemoryHistory::Entry memory_stats_from_last_assign_; |
| 159 | 157 |
| 160 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 158 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 161 | 159 |
| 162 bool use_color_estimator_; | |
| 163 bool did_initialize_visible_tile_; | 160 bool did_initialize_visible_tile_; |
| 164 | 161 |
| 165 GLenum texture_format_; | 162 GLenum texture_format_; |
| 166 | 163 |
| 167 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; | 164 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; |
| 168 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; | 165 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; |
| 169 LayerPixelRefTaskMap image_decode_tasks_; | 166 LayerPixelRefTaskMap image_decode_tasks_; |
| 170 | 167 |
| 171 DISALLOW_COPY_AND_ASSIGN(TileManager); | 168 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 172 }; | 169 }; |
| 173 | 170 |
| 174 } // namespace cc | 171 } // namespace cc |
| 175 | 172 |
| 176 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 173 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |