| 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_TILE_MANAGER_H_ | 5 #ifndef CC_TILE_MANAGER_H_ |
| 6 #define CC_TILE_MANAGER_H_ | 6 #define CC_TILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <queue> | 9 #include <queue> |
| 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/memory_history.h" | 15 #include "cc/memory_history.h" |
| 16 #include "cc/rendering_stats.h" | 16 #include "cc/rendering_stats.h" |
| 17 #include "cc/resource_pool.h" | 17 #include "cc/resource_pool.h" |
| 18 #include "cc/tile_priority.h" | 18 #include "cc/tile_priority.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 class RasterWorkerPool; | 21 class RasterWorkerPool; |
| 22 class ResourceProvider; | 22 class ResourceProvider; |
| 23 class Tile; | 23 class Tile; |
| 24 class TileVersion; | 24 class TileVersion; |
| 25 | 25 |
| 26 class CC_EXPORT TileManagerClient { | 26 class CC_EXPORT TileManagerClient { |
| 27 public: | 27 public: |
| 28 virtual void ScheduleManageTiles() = 0; | 28 virtual void ScheduleManageTiles() = 0; |
| 29 virtual void DidUploadVisibleHighResolutionTile() = 0; | 29 virtual void DidUploadVisibleHighResolutionTile() = 0; |
| 30 virtual bool CanDoAnotherCheapRaster() const = 0; |
| 31 virtual void DidPerformCheapRaster() = 0; |
| 30 | 32 |
| 31 protected: | 33 protected: |
| 32 virtual ~TileManagerClient() {} | 34 virtual ~TileManagerClient() {} |
| 33 }; | 35 }; |
| 34 | 36 |
| 35 // Tile manager classifying tiles into a few basic | 37 // Tile manager classifying tiles into a few basic |
| 36 // bins: | 38 // bins: |
| 37 enum TileManagerBin { | 39 enum TileManagerBin { |
| 38 NOW_BIN = 0, // Needed ASAP. | 40 NOW_BIN = 0, // Needed ASAP. |
| 39 SOON_BIN = 1, // Impl-side version of prepainting. | 41 SOON_BIN = 1, // Impl-side version of prepainting. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 client_->ScheduleManageTiles(); | 140 client_->ScheduleManageTiles(); |
| 139 manage_tiles_pending_ = true; | 141 manage_tiles_pending_ = true; |
| 140 } | 142 } |
| 141 void DispatchMoreTasks(); | 143 void DispatchMoreTasks(); |
| 142 void GatherPixelRefsForTile(Tile* tile); | 144 void GatherPixelRefsForTile(Tile* tile); |
| 143 void DispatchImageDecodeTasksForTile(Tile* tile); | 145 void DispatchImageDecodeTasksForTile(Tile* tile); |
| 144 void DispatchOneImageDecodeTask( | 146 void DispatchOneImageDecodeTask( |
| 145 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); | 147 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref); |
| 146 void OnImageDecodeTaskCompleted( | 148 void OnImageDecodeTaskCompleted( |
| 147 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); | 149 scoped_refptr<Tile> tile, uint32_t pixel_ref_id); |
| 148 bool CanDispatchRasterTask(Tile* tile); | 150 bool CanDispatchRasterTask(Tile* tile) const; |
| 151 bool CanPerformCheapRaster(Tile* tile) const; |
| 149 scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(Tile* tile); | 152 scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(Tile* tile); |
| 150 void DispatchOneRasterTask(scoped_refptr<Tile> tile); | 153 void DispatchOneRasterTask(scoped_refptr<Tile> tile); |
| 151 void PerformOneRaster(Tile* tile); | 154 void PerformOneCheapRaster(Tile* tile); |
| 152 void OnRasterCompleted( | 155 void OnRasterCompleted( |
| 153 scoped_refptr<Tile> tile, | 156 scoped_refptr<Tile> tile, |
| 154 scoped_ptr<ResourcePool::Resource> resource, | 157 scoped_ptr<ResourcePool::Resource> resource, |
| 155 int manage_tiles_call_count_when_dispatched); | 158 int manage_tiles_call_count_when_dispatched); |
| 156 void OnRasterTaskCompleted( | 159 void OnRasterTaskCompleted( |
| 157 scoped_refptr<Tile> tile, | 160 scoped_refptr<Tile> tile, |
| 158 scoped_ptr<ResourcePool::Resource> resource, | 161 scoped_ptr<ResourcePool::Resource> resource, |
| 159 int manage_tiles_call_count_when_dispatched); | 162 int manage_tiles_call_count_when_dispatched); |
| 160 void DidFinishTileInitialization(Tile* tile); | 163 void DidFinishTileInitialization(Tile* tile); |
| 161 void DidTileRasterStateChange(Tile* tile, TileRasterState state); | 164 void DidTileRasterStateChange(Tile* tile, TileRasterState state); |
| 162 void DidTileBinChange(Tile* tile, | 165 void DidTileBinChange(Tile* tile, |
| 163 TileManagerBin bin, | 166 TileManagerBin bin, |
| 164 WhichTree tree); | 167 WhichTree tree); |
| 165 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; | 168 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; |
| 166 | 169 |
| 167 static void PerformRaster(uint8* buffer, | 170 static void PerformRaster(uint8* buffer, |
| 168 const gfx::Rect& rect, | 171 const gfx::Rect& rect, |
| 169 float contents_scale, | 172 float contents_scale, |
| 170 bool use_cheapness_estimator, | 173 bool use_cheapness_estimator, |
| 171 PicturePileImpl* picture_pile, | 174 PicturePileImpl* picture_pile, |
| 172 RenderingStats* stats); | 175 RenderingStats* stats); |
| 173 static void RunImageDecodeTask(skia::LazyPixelRef* pixel_ref, | 176 static void PerformImageDecode(skia::LazyPixelRef* pixel_ref, |
| 174 RenderingStats* stats); | 177 RenderingStats* stats); |
| 175 | 178 |
| 176 static void RecordCheapnessPredictorResults(bool is_predicted_cheap, | 179 static void RecordCheapnessPredictorResults(bool is_predicted_cheap, |
| 177 bool is_actually_cheap); | 180 bool is_actually_cheap); |
| 178 | 181 |
| 179 TileManagerClient* client_; | 182 TileManagerClient* client_; |
| 180 scoped_ptr<ResourcePool> resource_pool_; | 183 scoped_ptr<ResourcePool> resource_pool_; |
| 181 scoped_ptr<RasterWorkerPool> raster_worker_pool_; | 184 scoped_ptr<RasterWorkerPool> raster_worker_pool_; |
| 182 bool manage_tiles_pending_; | 185 bool manage_tiles_pending_; |
| 183 int manage_tiles_call_count_; | 186 int manage_tiles_call_count_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 207 | 210 |
| 208 bool use_cheapness_estimator_; | 211 bool use_cheapness_estimator_; |
| 209 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 212 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
| 210 | 213 |
| 211 DISALLOW_COPY_AND_ASSIGN(TileManager); | 214 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 212 }; | 215 }; |
| 213 | 216 |
| 214 } // namespace cc | 217 } // namespace cc |
| 215 | 218 |
| 216 #endif // CC_TILE_MANAGER_H_ | 219 #endif // CC_TILE_MANAGER_H_ |
| OLD | NEW |