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 has_image_decoding_info; | |
58 std::list<skia::LazyPixelRef*> pending_pixel_refs; | |
reveman
2012/12/11 01:35:42
nit: can you make it obvious that these two member
qinmin
2012/12/11 04:30:15
Done.
| |
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 bool HasImageDecodingTasks(Tile*); | |
106 void OnImageDecodingTaskCompleted(scoped_refptr<Tile>, uint32_t); | |
107 void DispatchOneImageDecodingTask( | |
108 RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*); | |
109 void GetImageInformationForTile(Tile*); | |
110 RasterThread* GetFreeRasterThread(); | |
102 | 111 |
103 TileManagerClient* client_; | 112 TileManagerClient* client_; |
104 scoped_ptr<ResourcePool> resource_pool_; | 113 scoped_ptr<ResourcePool> resource_pool_; |
105 bool manage_tiles_pending_; | 114 bool manage_tiles_pending_; |
106 bool check_for_completed_set_pixels_pending_; | 115 bool check_for_completed_set_pixels_pending_; |
107 | 116 |
108 GlobalStateThatImpactsTilePriority global_state_; | 117 GlobalStateThatImpactsTilePriority global_state_; |
109 | 118 |
110 typedef std::vector<Tile*> TileVector; | 119 typedef std::vector<Tile*> TileVector; |
111 TileVector tiles_; | 120 TileVector tiles_; |
112 TileVector tiles_that_need_to_be_rasterized_; | 121 TileVector tiles_that_need_to_be_rasterized_; |
113 | 122 |
123 typedef std::list<Tile*> TileList; | |
124 // Tiles that are has image decoding tasks. | |
reveman
2012/12/11 01:35:42
I guess the proper name for the list is tiles_that
qinmin
2012/12/11 04:30:15
Done.
| |
125 TileList tiles_have_image_decoding_tasks_; | |
reveman
2012/12/11 01:35:42
nit: tiles_that_have_image_decoding_tasks_ or tile
qinmin
2012/12/11 04:30:15
Done.
| |
126 | |
127 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; | |
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 |