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

Side by Side Diff: cc/tile_manager.h

Issue 11593030: cc: Add RasterWorkerPool class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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>
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/rendering_stats.h"
15 #include "cc/resource_pool.h" 16 #include "cc/resource_pool.h"
16 #include "cc/tile_priority.h" 17 #include "cc/tile_priority.h"
17 18
18 namespace cc { 19 namespace cc {
19 20 class RasterWorker;
20 class RasterThread;
21 class ResourceProvider; 21 class ResourceProvider;
22 class Tile; 22 class Tile;
23 class TileVersion; 23 class TileVersion;
24 struct RenderingStats;
25 24
26 class CC_EXPORT TileManagerClient { 25 class CC_EXPORT TileManagerClient {
27 public: 26 public:
28 virtual void ScheduleManageTiles() = 0; 27 virtual void ScheduleManageTiles() = 0;
29 virtual void ScheduleCheckForCompletedSetPixels() = 0; 28 virtual void ScheduleCheckForCompletedSetPixels() = 0;
30 29
31 protected: 30 protected:
32 virtual ~TileManagerClient() {} 31 virtual ~TileManagerClient() {}
33 }; 32 };
34 33
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // should no longer have any memory assigned to them. Tile objects are "owned" 69 // should no longer have any memory assigned to them. Tile objects are "owned"
71 // by layers; they automatically register with the manager when they are 70 // by layers; they automatically register with the manager when they are
72 // created, and unregister from the manager when they are deleted. 71 // created, and unregister from the manager when they are deleted.
73 class CC_EXPORT TileManager { 72 class CC_EXPORT TileManager {
74 public: 73 public:
75 TileManager(TileManagerClient* client, 74 TileManager(TileManagerClient* client,
76 ResourceProvider *resource_provider, 75 ResourceProvider *resource_provider,
77 size_t num_raster_threads); 76 size_t num_raster_threads);
78 virtual ~TileManager(); 77 virtual ~TileManager();
79 78
80 const GlobalStateThatImpactsTilePriority& GlobalState() const { return global_ state_; } 79 const GlobalStateThatImpactsTilePriority& GlobalState() const {
80 return global_state_;
81 }
81 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); 82 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state);
82 83
83 void ManageTiles(); 84 void ManageTiles();
84 void CheckForCompletedSetPixels(); 85 void CheckForCompletedSetPixels();
85 86
86 void GetRenderingStats(RenderingStats* stats); 87 void GetRenderingStats(RenderingStats* stats);
87 88
88 int GetTilesInBinCount(TileManagerBin bin, WhichTree tree); 89 int GetTilesInBinCount(TileManagerBin bin, WhichTree tree);
89 int GetDrawableTilesInBinCount(TileManagerBin bin, WhichTree tree); 90 int GetDrawableTilesInBinCount(TileManagerBin bin, WhichTree tree);
90 91
91 protected: 92 protected:
92 // Methods called by Tile 93 // Methods called by Tile
93 friend class Tile; 94 friend class Tile;
94 void RegisterTile(Tile*); 95 void RegisterTile(Tile* tile);
95 void UnregisterTile(Tile*); 96 void UnregisterTile(Tile* tile);
96 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority ); 97 void WillModifyTilePriority(
98 Tile* tile, WhichTree tree, const TilePriority& new_priority);
97 99
98 private: 100 private:
99 void ResetBinCounts(); 101 void ResetBinCounts();
100 void AssignGpuMemoryToTiles(); 102 void AssignGpuMemoryToTiles();
101 void FreeResourcesForTile(Tile*); 103 void FreeResourcesForTile(Tile* tile);
102 void ScheduleManageTiles(); 104 void ScheduleManageTiles();
103 void ScheduleCheckForCompletedSetPixels(); 105 void ScheduleCheckForCompletedSetPixels();
104 void DispatchMoreTasks(); 106 void DispatchMoreTasks();
105 void DispatchOneRasterTask(RasterThread*, scoped_refptr<Tile>); 107 void GatherPixelRefsForTile(Tile* tile);
108 void DispatchImageDecodingTasksForTile(Tile* tile);
109 void DispatchOneImageDecodingTask(
110 scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref);
111 void OnImageDecodingTaskCompleted(
112 scoped_refptr<Tile> tile, uint32_t pixel_ref_id);
113 void DispatchOneRasterTask(scoped_refptr<Tile> tile);
106 void OnRasterTaskCompleted( 114 void OnRasterTaskCompleted(
107 scoped_refptr<Tile>, 115 scoped_refptr<Tile> tile,
108 scoped_ptr<ResourcePool::Resource>, 116 scoped_ptr<ResourcePool::Resource> resource,
109 scoped_refptr<PicturePileImpl>, 117 int manage_tiles_call_count_when_dispatched);
110 int manage_tiles_call_count_when_dispatched, 118 void DidFinishTileInitialization(Tile* tile);
111 RenderingStats*);
112 void DidFinishTileInitialization(Tile*);
113 void DispatchImageDecodingTasksForTile(Tile*);
114 void OnImageDecodingTaskCompleted(scoped_refptr<Tile>,
115 uint32_t,
116 RenderingStats*);
117 void DispatchOneImageDecodingTask(
118 RasterThread*, scoped_refptr<Tile>, skia::LazyPixelRef*);
119 void GatherPixelRefsForTile(Tile*);
120 RasterThread* GetFreeRasterThread();
121 119
122 TileManagerClient* client_; 120 TileManagerClient* client_;
123 scoped_ptr<ResourcePool> resource_pool_; 121 scoped_ptr<ResourcePool> resource_pool_;
122 scoped_ptr<RasterWorker> raster_worker_;
124 bool manage_tiles_pending_; 123 bool manage_tiles_pending_;
125 int manage_tiles_call_count_; 124 int manage_tiles_call_count_;
126 bool check_for_completed_set_pixels_pending_; 125 bool check_for_completed_set_pixels_pending_;
127 126
128 GlobalStateThatImpactsTilePriority global_state_; 127 GlobalStateThatImpactsTilePriority global_state_;
129 128
130 int tiles_in_bin_count_[NUM_BINS][NUM_TREES]; 129 int tiles_in_bin_count_[NUM_BINS][NUM_TREES];
131 int drawable_tiles_in_bin_count_[NUM_BINS][NUM_TREES]; 130 int drawable_tiles_in_bin_count_[NUM_BINS][NUM_TREES];
132 131
133 typedef std::vector<Tile*> TileVector; 132 typedef std::vector<Tile*> TileVector;
134 TileVector tiles_; 133 TileVector tiles_;
135 TileVector tiles_that_need_to_be_rasterized_; 134 TileVector tiles_that_need_to_be_rasterized_;
136 135
137 typedef std::list<Tile*> TileList; 136 typedef std::list<Tile*> TileList;
138 // Tiles with image decoding tasks. These tiles need to be rasterized 137 // Tiles with image decoding tasks. These tiles need to be rasterized
139 // when all the image decoding tasks finish. 138 // when all the image decoding tasks finish.
140 TileList tiles_with_image_decoding_tasks_; 139 TileList tiles_with_image_decoding_tasks_;
141 140
142 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap; 141 typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap;
143 PixelRefMap pending_decode_tasks_; 142 PixelRefMap pending_decode_tasks_;
144 143
145 typedef std::queue<scoped_refptr<Tile> > TileQueue; 144 typedef std::queue<scoped_refptr<Tile> > TileQueue;
146 TileQueue tiles_with_pending_set_pixels_; 145 TileQueue tiles_with_pending_set_pixels_;
147 146
148 typedef ScopedPtrVector<RasterThread> RasterThreadVector;
149 RasterThreadVector raster_threads_;
150
151 RenderingStats rendering_stats_; 147 RenderingStats rendering_stats_;
152 148
153 DISALLOW_COPY_AND_ASSIGN(TileManager); 149 DISALLOW_COPY_AND_ASSIGN(TileManager);
154 }; 150 };
155 151
156 } // namespace cc 152 } // namespace cc
157 153
158 #endif // CC_TILE_MANAGER_H_ 154 #endif // CC_TILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698