| 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 <set> | 10 #include <set> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 bool is_tile_in_pending_tree_now_bin; | 71 bool is_tile_in_pending_tree_now_bin; |
| 72 TileResolution tile_resolution; | 72 TileResolution tile_resolution; |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 // This is state that is specific to a tile that is | 75 // This is state that is specific to a tile that is |
| 76 // managed by the TileManager. | 76 // managed by the TileManager. |
| 77 class CC_EXPORT ManagedTileState : public base::RefCounted<ManagedTileState> { | 77 class CC_EXPORT ManagedTileState : public base::RefCounted<ManagedTileState> { |
| 78 public: | 78 public: |
| 79 ManagedTileState(Tile* tile); | 79 ManagedTileState(Tile* tile); |
| 80 scoped_ptr<base::Value> AsValue() const; | 80 scoped_ptr<base::Value> AsValue() const; |
| 81 bool can_be_freed() const { return !cannot_be_freed_ref.get(); } |
| 81 | 82 |
| 82 // Persisted state: valid all the time. | 83 // Persisted state: valid all the time. |
| 83 scoped_refptr<Tile> tile; | 84 scoped_refptr<Tile> tile; |
| 84 bool can_use_gpu_memory; | 85 bool can_use_gpu_memory; |
| 85 bool can_be_freed; | 86 scoped_refptr<ManagedTileState> cannot_be_freed_ref; |
| 86 scoped_ptr<ResourcePool::Resource> resource; | 87 scoped_ptr<ResourcePool::Resource> resource; |
| 87 bool resource_is_being_initialized; | 88 bool resource_is_being_initialized; |
| 88 bool contents_swizzled; | 89 bool contents_swizzled; |
| 89 bool need_to_gather_pixel_refs; | 90 bool need_to_gather_pixel_refs; |
| 90 std::list<skia::LazyPixelRef*> pending_pixel_refs; | 91 std::list<skia::LazyPixelRef*> pending_pixel_refs; |
| 91 TileRasterState raster_state; | 92 TileRasterState raster_state; |
| 92 | 93 |
| 93 // Ephemeral state, valid only during Manage. | 94 // Ephemeral state, valid only during Manage. |
| 94 TileManagerBin bin[NUM_BIN_PRIORITIES]; | 95 TileManagerBin bin[NUM_BIN_PRIORITIES]; |
| 95 TileManagerBin tree_bin[NUM_TREES]; | 96 TileManagerBin tree_bin[NUM_TREES]; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 void DispatchOneRasterTask(scoped_refptr<ManagedTileState> tile); | 181 void DispatchOneRasterTask(scoped_refptr<ManagedTileState> tile); |
| 181 void PerformOneRaster(ManagedTileState* mts); | 182 void PerformOneRaster(ManagedTileState* mts); |
| 182 void OnRasterCompleted( | 183 void OnRasterCompleted( |
| 183 scoped_refptr<ManagedTileState> tile, | 184 scoped_refptr<ManagedTileState> tile, |
| 184 scoped_ptr<ResourcePool::Resource> resource, | 185 scoped_ptr<ResourcePool::Resource> resource, |
| 185 int manage_tiles_call_count_when_dispatched); | 186 int manage_tiles_call_count_when_dispatched); |
| 186 void OnRasterTaskCompleted( | 187 void OnRasterTaskCompleted( |
| 187 scoped_refptr<ManagedTileState> tile, | 188 scoped_refptr<ManagedTileState> tile, |
| 188 scoped_ptr<ResourcePool::Resource> resource, | 189 scoped_ptr<ResourcePool::Resource> resource, |
| 189 int manage_tiles_call_count_when_dispatched); | 190 int manage_tiles_call_count_when_dispatched); |
| 190 void DidFinishTileInitialization(ManagedTileState* mts); | |
| 191 void DidTileRasterStateChange(ManagedTileState* mts, TileRasterState state); | 191 void DidTileRasterStateChange(ManagedTileState* mts, TileRasterState state); |
| 192 void DidTileTreeBinChange(ManagedTileState* mts, | 192 void DidTileTreeBinChange(ManagedTileState* mts, |
| 193 TileManagerBin new_tree_bin, | 193 TileManagerBin new_tree_bin, |
| 194 WhichTree tree); | 194 WhichTree tree); |
| 195 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; | 195 scoped_ptr<Value> GetMemoryRequirementsAsValue() const; |
| 196 | 196 |
| 197 static void PerformRaster(uint8* buffer, | 197 static void PerformRaster(uint8* buffer, |
| 198 const gfx::Rect& rect, | 198 const gfx::Rect& rect, |
| 199 float contents_scale, | 199 float contents_scale, |
| 200 bool use_cheapness_estimator, | 200 bool use_cheapness_estimator, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 bool use_cheapness_estimator_; | 242 bool use_cheapness_estimator_; |
| 243 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; | 243 int raster_state_count_[NUM_STATES][NUM_TREES][NUM_BINS]; |
| 244 | 244 |
| 245 DISALLOW_COPY_AND_ASSIGN(TileManager); | 245 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 246 }; | 246 }; |
| 247 | 247 |
| 248 } // namespace cc | 248 } // namespace cc |
| 249 | 249 |
| 250 #endif // CC_TILE_MANAGER_H_ | 250 #endif // CC_TILE_MANAGER_H_ |
| OLD | NEW |