Chromium Code Reviews| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 scoped_ptr<base::Value> AllTilesAsValue() const; | 81 scoped_ptr<base::Value> AllTilesAsValue() const; |
| 82 void GetMemoryStats(size_t* memory_required_bytes, | 82 void GetMemoryStats(size_t* memory_required_bytes, |
| 83 size_t* memory_nice_to_have_bytes, | 83 size_t* memory_nice_to_have_bytes, |
| 84 size_t* memory_used_bytes) const; | 84 size_t* memory_used_bytes) const; |
| 85 | 85 |
| 86 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 86 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
| 87 return memory_stats_from_last_assign_; | 87 return memory_stats_from_last_assign_; |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool AreTilesRequiredForActivationReady() const { | 90 bool AreTilesRequiredForActivationReady() const { |
| 91 return tiles_that_need_to_be_initialized_for_activation_.empty(); | 91 return tiles_that_need_to_be_initialized_for_activation_.empty() && |
| 92 oom_tiles_that_need_to_be_initialized_for_activation_.empty(); | |
|
boliu
2013/07/01 20:40:23
The android_webivew tests run in software mode wit
| |
| 92 } | 93 } |
| 93 | 94 |
| 94 protected: | 95 protected: |
| 95 TileManager(TileManagerClient* client, | 96 TileManager(TileManagerClient* client, |
| 96 ResourceProvider* resource_provider, | 97 ResourceProvider* resource_provider, |
| 97 scoped_ptr<RasterWorkerPool> raster_worker_pool, | 98 scoped_ptr<RasterWorkerPool> raster_worker_pool, |
| 98 size_t num_raster_threads, | 99 size_t num_raster_threads, |
| 99 bool use_color_estimator, | 100 bool use_color_estimator, |
| 100 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 101 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 101 GLenum texture_format); | 102 GLenum texture_format); |
| 102 | 103 |
| 103 // Methods called by Tile | 104 // Methods called by Tile |
| 104 friend class Tile; | 105 friend class Tile; |
| 105 void RegisterTile(Tile* tile); | 106 void RegisterTile(Tile* tile); |
| 106 void UnregisterTile(Tile* tile); | 107 void UnregisterTile(Tile* tile); |
| 107 | 108 |
| 108 // Overriden from RasterWorkerPoolClient: | 109 // Overriden from RasterWorkerPoolClient: |
| 109 virtual bool ShouldForceTasksRequiredForActivationToComplete() const | 110 virtual bool ShouldForceTasksRequiredForActivationToComplete() const |
| 110 OVERRIDE; | 111 OVERRIDE; |
| 112 virtual void DidFinishedRunningTasks() OVERRIDE; | |
| 113 virtual void DidFinishedRunningTasksRequiredForActivation() OVERRIDE; | |
| 111 | 114 |
| 112 // Virtual for test | 115 // Virtual for test |
| 113 virtual void ScheduleTasks(); | 116 virtual void ScheduleTasks(); |
| 114 | 117 |
| 118 const std::vector<Tile*>& tiles_that_need_to_be_rasterized() const { | |
| 119 return tiles_that_need_to_be_rasterized_; | |
| 120 } | |
| 121 | |
| 122 void ReassignGpuMemoryToOOMTilesRequiredForActivation(); | |
| 123 | |
| 115 private: | 124 private: |
| 116 void OnImageDecodeTaskCompleted( | 125 void OnImageDecodeTaskCompleted( |
| 117 int layer_id, | 126 int layer_id, |
| 118 skia::LazyPixelRef* pixel_ref, | 127 skia::LazyPixelRef* pixel_ref, |
| 119 bool was_canceled); | 128 bool was_canceled); |
| 120 void OnRasterTaskCompleted( | 129 void OnRasterTaskCompleted( |
| 121 scoped_refptr<Tile> tile, | 130 scoped_refptr<Tile> tile, |
| 122 scoped_ptr<ResourcePool::Resource> resource, | 131 scoped_ptr<ResourcePool::Resource> resource, |
| 123 RasterMode raster_mode, | 132 RasterMode raster_mode, |
| 124 const PicturePileImpl::Analysis& analysis, | 133 const PicturePileImpl::Analysis& analysis, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 146 TileManagerClient* client_; | 155 TileManagerClient* client_; |
| 147 scoped_ptr<ResourcePool> resource_pool_; | 156 scoped_ptr<ResourcePool> resource_pool_; |
| 148 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 157 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
| 149 GlobalStateThatImpactsTilePriority global_state_; | 158 GlobalStateThatImpactsTilePriority global_state_; |
| 150 | 159 |
| 151 typedef std::vector<Tile*> TileVector; | 160 typedef std::vector<Tile*> TileVector; |
| 152 TileVector tiles_; | 161 TileVector tiles_; |
| 153 TileVector tiles_that_need_to_be_rasterized_; | 162 TileVector tiles_that_need_to_be_rasterized_; |
| 154 typedef std::set<Tile*> TileSet; | 163 typedef std::set<Tile*> TileSet; |
| 155 TileSet tiles_that_need_to_be_initialized_for_activation_; | 164 TileSet tiles_that_need_to_be_initialized_for_activation_; |
| 165 TileSet oom_tiles_that_need_to_be_initialized_for_activation_; | |
| 156 | 166 |
| 157 bool ever_exceeded_memory_budget_; | 167 bool ever_exceeded_memory_budget_; |
| 158 MemoryHistory::Entry memory_stats_from_last_assign_; | 168 MemoryHistory::Entry memory_stats_from_last_assign_; |
| 159 | 169 |
| 160 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 170 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
| 161 | 171 |
| 162 bool use_color_estimator_; | 172 bool use_color_estimator_; |
| 163 bool did_initialize_visible_tile_; | 173 bool did_initialize_visible_tile_; |
| 164 | 174 |
| 165 GLenum texture_format_; | 175 GLenum texture_format_; |
| 166 | 176 |
| 167 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; | 177 typedef base::hash_map<uint32_t, RasterWorkerPool::Task> PixelRefTaskMap; |
| 168 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; | 178 typedef base::hash_map<int, PixelRefTaskMap> LayerPixelRefTaskMap; |
| 169 LayerPixelRefTaskMap image_decode_tasks_; | 179 LayerPixelRefTaskMap image_decode_tasks_; |
| 170 | 180 |
| 171 DISALLOW_COPY_AND_ASSIGN(TileManager); | 181 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 172 }; | 182 }; |
| 173 | 183 |
| 174 } // namespace cc | 184 } // namespace cc |
| 175 | 185 |
| 176 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 186 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |