Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: cc/tile_manager.h

Issue 11568027: cc: Add TileManager interface that allows LTHI to determine when to activate pending tree. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Determine bin for each tree. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // Persisted state: valid all the time. 52 // Persisted state: valid all the time.
53 bool can_use_gpu_memory; 53 bool can_use_gpu_memory;
54 bool can_be_freed; 54 bool can_be_freed;
55 scoped_ptr<ResourcePool::Resource> resource; 55 scoped_ptr<ResourcePool::Resource> resource;
56 bool resource_is_being_initialized; 56 bool resource_is_being_initialized;
57 bool contents_swizzled; 57 bool contents_swizzled;
58 bool need_to_gather_pixel_refs; 58 bool need_to_gather_pixel_refs;
59 std::list<skia::LazyPixelRef*> pending_pixel_refs; 59 std::list<skia::LazyPixelRef*> pending_pixel_refs;
60 60
61 // Ephemeral state, valid only during Manage. 61 // Ephemeral state, valid only during Manage.
62 TileManagerBin bin; 62 TileManagerBin bin[NUM_TREES];
63 // Bin used to determine raster priority.
64 TileManagerBin raster_bin;
63 TileResolution resolution; 65 TileResolution resolution;
64 float time_to_needed_in_seconds; 66 float time_to_needed_in_seconds;
65 }; 67 };
66 68
67 // This class manages tiles, deciding which should get rasterized and which 69 // This class manages tiles, deciding which should get rasterized and which
68 // should no longer have any memory assigned to them. Tile objects are "owned" 70 // should no longer have any memory assigned to them. Tile objects are "owned"
69 // by layers; they automatically register with the manager when they are 71 // by layers; they automatically register with the manager when they are
70 // created, and unregister from the manager when they are deleted. 72 // created, and unregister from the manager when they are deleted.
71 class CC_EXPORT TileManager { 73 class CC_EXPORT TileManager {
72 public: 74 public:
73 TileManager(TileManagerClient* client, 75 TileManager(TileManagerClient* client,
74 ResourceProvider *resource_provider, 76 ResourceProvider *resource_provider,
75 size_t num_raster_threads); 77 size_t num_raster_threads);
76 virtual ~TileManager(); 78 virtual ~TileManager();
77 79
78 const GlobalStateThatImpactsTilePriority& GlobalState() const { return global_ state_; } 80 const GlobalStateThatImpactsTilePriority& GlobalState() const { return global_ state_; }
79 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); 81 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state);
80 82
81 void ManageTiles(); 83 void ManageTiles();
82 void CheckForCompletedSetPixels(); 84 void CheckForCompletedSetPixels();
83 85
84 void renderingStats(RenderingStats* stats); 86 void GetRenderingStats(RenderingStats* stats);
87
88 int GetTilesInBinCount(TileManagerBin bin, WhichTree tree);
89 int GetDrawableTilesInBinCount(TileManagerBin bin, WhichTree tree);
85 90
86 protected: 91 protected:
87 // Methods called by Tile 92 // Methods called by Tile
88 friend class Tile; 93 friend class Tile;
89 void RegisterTile(Tile*); 94 void RegisterTile(Tile*);
90 void UnregisterTile(Tile*); 95 void UnregisterTile(Tile*);
91 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority ); 96 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority );
92 97
93 private: 98 private:
99 void ResetBinCounts();
94 void AssignGpuMemoryToTiles(); 100 void AssignGpuMemoryToTiles();
95 void FreeResourcesForTile(Tile*); 101 void FreeResourcesForTile(Tile*);
96 void ScheduleManageTiles(); 102 void ScheduleManageTiles();
97 void ScheduleCheckForCompletedSetPixels(); 103 void ScheduleCheckForCompletedSetPixels();
98 void DispatchMoreTasks(); 104 void DispatchMoreTasks();
99 void DispatchOneRasterTask(RasterThread*, scoped_refptr<Tile>); 105 void DispatchOneRasterTask(RasterThread*, scoped_refptr<Tile>);
100 void OnRasterTaskCompleted( 106 void OnRasterTaskCompleted(
101 scoped_refptr<Tile>, 107 scoped_refptr<Tile>,
102 scoped_ptr<ResourcePool::Resource>, 108 scoped_ptr<ResourcePool::Resource>,
103 scoped_refptr<PicturePileImpl>, 109 scoped_refptr<PicturePileImpl>,
104 RenderingStats*); 110 RenderingStats*);
105 void DidFinishTileInitialization(Tile*); 111 void DidFinishTileInitialization(Tile*);
106 void DispatchImageDecodingTasksForTile(Tile*); 112 void DispatchImageDecodingTasksForTile(Tile*);
107 void OnImageDecodingTaskCompleted(scoped_refptr<Tile>, uint32_t); 113 void OnImageDecodingTaskCompleted(scoped_refptr<Tile>, uint32_t);
108 void DispatchOneImageDecodingTask( 114 void DispatchOneImageDecodingTask(
109 RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*); 115 RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*);
110 RasterThread* GetFreeRasterThread(); 116 RasterThread* GetFreeRasterThread();
111 117
112 TileManagerClient* client_; 118 TileManagerClient* client_;
113 scoped_ptr<ResourcePool> resource_pool_; 119 scoped_ptr<ResourcePool> resource_pool_;
114 bool manage_tiles_pending_; 120 bool manage_tiles_pending_;
115 bool check_for_completed_set_pixels_pending_; 121 bool check_for_completed_set_pixels_pending_;
116 122
117 GlobalStateThatImpactsTilePriority global_state_; 123 GlobalStateThatImpactsTilePriority global_state_;
118 124
125 int tiles_in_bin_count_[NUM_BINS][NUM_TREES];
126 int drawable_tiles_in_bin_count_[NUM_BINS][NUM_TREES];
127
119 typedef std::vector<Tile*> TileVector; 128 typedef std::vector<Tile*> TileVector;
120 TileVector tiles_; 129 TileVector tiles_;
121 TileVector tiles_that_need_to_be_rasterized_; 130 TileVector tiles_that_need_to_be_rasterized_;
122 131
123 typedef std::list<Tile*> TileList; 132 typedef std::list<Tile*> TileList;
124 // Tiles with image decoding tasks. These tiles need to be rasterized 133 // Tiles with image decoding tasks. These tiles need to be rasterized
125 // when all the image decoding tasks finish. 134 // when all the image decoding tasks finish.
126 TileList tiles_with_image_decoding_tasks_; 135 TileList tiles_with_image_decoding_tasks_;
127 136
128 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; 137 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap;
129 PixelRefMap pending_decode_tasks_; 138 PixelRefMap pending_decode_tasks_;
130 139
131 typedef std::queue<scoped_refptr<Tile> > TileQueue; 140 typedef std::queue<scoped_refptr<Tile> > TileQueue;
132 TileQueue tiles_with_pending_set_pixels_; 141 TileQueue tiles_with_pending_set_pixels_;
133 142
134 typedef ScopedPtrVector<RasterThread> RasterThreadVector; 143 typedef ScopedPtrVector<RasterThread> RasterThreadVector;
135 RasterThreadVector raster_threads_; 144 RasterThreadVector raster_threads_;
136 145
137 RenderingStats rendering_stats_; 146 RenderingStats rendering_stats_;
138 147
139 DISALLOW_COPY_AND_ASSIGN(TileManager); 148 DISALLOW_COPY_AND_ASSIGN(TileManager);
140 }; 149 };
141 150
142 } // namespace cc 151 } // namespace cc
143 152
144 #endif // CC_TILE_MANAGER_H_ 153 #endif // CC_TILE_MANAGER_H_
OLDNEW
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/tile_manager.cc » ('j') | cc/tile_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698