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_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 <queue> | 9 #include <queue> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "cc/resource_pool.h" | 14 #include "cc/resource_pool.h" |
| 14 #include "cc/tile_priority.h" | 15 #include "cc/tile_priority.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 | 18 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 46 public: | 47 public: |
| 47 ManagedTileState(); | 48 ManagedTileState(); |
| 48 ~ManagedTileState(); | 49 ~ManagedTileState(); |
| 49 | 50 |
| 50 // Persisted state: valid all the time. | 51 // Persisted state: valid all the time. |
| 51 bool can_use_gpu_memory; | 52 bool can_use_gpu_memory; |
| 52 bool can_be_freed; | 53 bool can_be_freed; |
| 53 scoped_ptr<ResourcePool::Resource> resource; | 54 scoped_ptr<ResourcePool::Resource> resource; |
| 54 bool resource_is_being_initialized; | 55 bool resource_is_being_initialized; |
| 55 bool contents_swizzled; | 56 bool contents_swizzled; |
| 57 bool need_to_gather_pixel_refs; | |
| 58 std::list<skia::LazyPixelRef*> pending_pixel_refs; | |
| 56 | 59 |
| 57 // Ephemeral state, valid only during Manage. | 60 // Ephemeral state, valid only during Manage. |
| 58 TileManagerBin bin; | 61 TileManagerBin bin; |
| 59 TileResolution resolution; | 62 TileResolution resolution; |
| 60 float time_to_needed_in_seconds; | 63 float time_to_needed_in_seconds; |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 // This class manages tiles, deciding which should get rasterized and which | 66 // This class manages tiles, deciding which should get rasterized and which |
| 64 // should no longer have any memory assigned to them. Tile objects are "owned" | 67 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 65 // by layers; they automatically register with the manager when they are | 68 // by layers; they automatically register with the manager when they are |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 84 friend class Tile; | 87 friend class Tile; |
| 85 void RegisterTile(Tile*); | 88 void RegisterTile(Tile*); |
| 86 void UnregisterTile(Tile*); | 89 void UnregisterTile(Tile*); |
| 87 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority ); | 90 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority ); |
| 88 | 91 |
| 89 private: | 92 private: |
| 90 void AssignGpuMemoryToTiles(); | 93 void AssignGpuMemoryToTiles(); |
| 91 void FreeResourcesForTile(Tile*); | 94 void FreeResourcesForTile(Tile*); |
| 92 void ScheduleManageTiles(); | 95 void ScheduleManageTiles(); |
| 93 void ScheduleCheckForCompletedSetPixels(); | 96 void ScheduleCheckForCompletedSetPixels(); |
| 94 void DispatchMoreRasterTasks(); | 97 void DispatchMoreTasks(); |
| 95 void DispatchOneRasterTask(RasterThread*, scoped_refptr<Tile>); | 98 void DispatchOneRasterTask(RasterThread*, scoped_refptr<Tile>); |
| 96 void OnRasterTaskCompleted( | 99 void OnRasterTaskCompleted( |
| 97 scoped_refptr<Tile>, | 100 scoped_refptr<Tile>, |
| 98 scoped_ptr<ResourcePool::Resource>, | 101 scoped_ptr<ResourcePool::Resource>, |
| 99 scoped_refptr<PicturePileImpl>, | 102 scoped_refptr<PicturePileImpl>, |
| 100 RenderingStats*); | 103 RenderingStats*); |
| 101 void DidFinishTileInitialization(Tile*); | 104 void DidFinishTileInitialization(Tile*); |
| 105 void DispatchImageDecodingTasksForTile(Tile*); | |
| 106 void OnImageDecodingTaskCompleted(scoped_refptr<Tile>, uint32_t); | |
| 107 void DispatchOneImageDecodingTask( | |
| 108 RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*); | |
| 109 RasterThread* GetFreeRasterThread(); | |
| 102 | 110 |
| 103 TileManagerClient* client_; | 111 TileManagerClient* client_; |
| 104 scoped_ptr<ResourcePool> resource_pool_; | 112 scoped_ptr<ResourcePool> resource_pool_; |
| 105 bool manage_tiles_pending_; | 113 bool manage_tiles_pending_; |
| 106 bool check_for_completed_set_pixels_pending_; | 114 bool check_for_completed_set_pixels_pending_; |
| 107 | 115 |
| 108 GlobalStateThatImpactsTilePriority global_state_; | 116 GlobalStateThatImpactsTilePriority global_state_; |
| 109 | 117 |
| 110 typedef std::vector<Tile*> TileVector; | 118 typedef std::vector<Tile*> TileVector; |
| 111 TileVector tiles_; | 119 TileVector tiles_; |
| 112 TileVector tiles_that_need_to_be_rasterized_; | 120 TileVector tiles_that_need_to_be_rasterized_; |
| 113 | 121 |
| 122 typedef std::list<Tile*> TileList; | |
| 123 // Tiles that are has image decoding tasks. These tiles needs to be rasterized | |
|
reveman
2012/12/11 05:07:18
nit: s/that are has image decoding tasks/with imag
qinmin
2012/12/11 05:36:20
done, also fixed needs->need
On 2012/12/11 05:07:1
| |
| 124 // when all the image decoding tasks finish. | |
| 125 TileList tiles_with_image_decoding_tasks_; | |
| 126 | |
| 127 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; | |
|
reveman
2012/12/11 05:07:18
nit: add "base/hash_tables.h" to includes
qinmin
2012/12/11 05:36:20
Done.
| |
| 128 PixelRefMap pending_decode_tasks_; | |
| 129 | |
| 114 typedef std::queue<scoped_refptr<Tile> > TileQueue; | 130 typedef std::queue<scoped_refptr<Tile> > TileQueue; |
| 115 TileQueue tiles_with_pending_set_pixels_; | 131 TileQueue tiles_with_pending_set_pixels_; |
| 116 | 132 |
| 117 typedef ScopedPtrVector<RasterThread> RasterThreadVector; | 133 typedef ScopedPtrVector<RasterThread> RasterThreadVector; |
| 118 RasterThreadVector raster_threads_; | 134 RasterThreadVector raster_threads_; |
| 119 | 135 |
| 120 RenderingStats rendering_stats_; | 136 RenderingStats rendering_stats_; |
| 121 | 137 |
| 122 DISALLOW_COPY_AND_ASSIGN(TileManager); | 138 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 123 }; | 139 }; |
| 124 | 140 |
| 125 } // namespace cc | 141 } // namespace cc |
| 126 | 142 |
| 127 #endif // CC_TILE_MANAGER_H_ | 143 #endif // CC_TILE_MANAGER_H_ |
| OLD | NEW |