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

Unified Diff: cc/tile_manager.h

Issue 12289020: cc: Make the TileManager operate on ManagedTileState directly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix clang dtor nits Created 7 years, 10 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tile.cc ('k') | cc/tile_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tile_manager.h
diff --git a/cc/tile_manager.h b/cc/tile_manager.h
index e05217b5b527ab0ee2edfd31d6fd25658a9b1015..3d198bd40c974b45baf391571365c65561d91442 100644
--- a/cc/tile_manager.h
+++ b/cc/tile_manager.h
@@ -23,6 +23,7 @@ namespace cc {
class RasterWorkerPool;
class ResourceProvider;
class Tile;
+class TileManager;
class TileVersion;
class CC_EXPORT TileManagerClient {
@@ -73,13 +74,13 @@ struct RasterTaskMetadata {
// This is state that is specific to a tile that is
// managed by the TileManager.
-class CC_EXPORT ManagedTileState {
+class CC_EXPORT ManagedTileState : public base::RefCounted<ManagedTileState> {
public:
- ManagedTileState();
- ~ManagedTileState();
+ ManagedTileState(Tile* tile);
scoped_ptr<base::Value> AsValue() const;
// Persisted state: valid all the time.
+ scoped_refptr<Tile> tile;
bool can_use_gpu_memory;
bool can_be_freed;
scoped_ptr<ResourcePool::Resource> resource;
@@ -98,6 +99,10 @@ class CC_EXPORT ManagedTileState {
TileResolution resolution;
float time_to_needed_in_seconds;
float distance_to_visible_in_pixels;
+
+ private:
+ friend class base::RefCounted<ManagedTileState>;
+ ~ManagedTileState();
};
// This class manages tiles, deciding which should get rasterized and which
@@ -140,8 +145,9 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
protected:
// Methods called by Tile
friend class Tile;
- void RegisterTile(Tile* tile);
- void UnregisterTile(Tile* tile);
+ friend class TileHandle;
+ friend class ManagedTileState;
+ scoped_refptr<ManagedTileState> RegisterTile(Tile* tile);
void WillModifyTilePriority(
Tile* tile, WhichTree tree, const TilePriority& new_priority) {
// TODO(nduca): Do something smarter if reprioritization turns out to be
@@ -150,9 +156,11 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
}
private:
+ void RegisterManagedTile(ManagedTileState* mts);
+ void UnregisterManagedTile(ManagedTileState* mts);
void SortTiles();
void AssignGpuMemoryToTiles();
- void FreeResourcesForTile(Tile* tile);
+ void FreeResourcesForTile(ManagedTileState* mts);
void ScheduleManageTiles() {
if (manage_tiles_pending_)
return;
@@ -160,28 +168,28 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
manage_tiles_pending_ = true;
}
void DispatchMoreTasks();
- void GatherPixelRefsForTile(Tile* tile);
- void DispatchImageDecodeTasksForTile(Tile* tile);
+ void GatherPixelRefsForTile(ManagedTileState* mts);
+ void DispatchImageDecodeTasksForTile(ManagedTileState* mts);
void DispatchOneImageDecodeTask(
- scoped_refptr<Tile> tile, skia::LazyPixelRef* pixel_ref);
+ scoped_refptr<ManagedTileState> tile, skia::LazyPixelRef* pixel_ref);
void OnImageDecodeTaskCompleted(
- scoped_refptr<Tile> tile,
- uint32_t pixel_ref_id);
- bool CanDispatchRasterTask(Tile* tile);
- scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(Tile* tile);
- void DispatchOneRasterTask(scoped_refptr<Tile> tile);
- void PerformOneRaster(Tile* tile);
+ scoped_refptr<ManagedTileState> tile, uint32_t pixel_ref_id);
+ bool CanDispatchRasterTask(ManagedTileState* mts);
+ scoped_ptr<ResourcePool::Resource> PrepareTileForRaster(
+ ManagedTileState* mts);
+ void DispatchOneRasterTask(scoped_refptr<ManagedTileState> tile);
+ void PerformOneRaster(ManagedTileState* mts);
void OnRasterCompleted(
- scoped_refptr<Tile> tile,
+ scoped_refptr<ManagedTileState> tile,
scoped_ptr<ResourcePool::Resource> resource,
int manage_tiles_call_count_when_dispatched);
void OnRasterTaskCompleted(
- scoped_refptr<Tile> tile,
+ scoped_refptr<ManagedTileState> tile,
scoped_ptr<ResourcePool::Resource> resource,
int manage_tiles_call_count_when_dispatched);
- void DidFinishTileInitialization(Tile* tile);
- void DidTileRasterStateChange(Tile* tile, TileRasterState state);
- void DidTileTreeBinChange(Tile* tile,
+ void DidFinishTileInitialization(ManagedTileState* mts);
+ void DidTileRasterStateChange(ManagedTileState* mts, TileRasterState state);
+ void DidTileTreeBinChange(ManagedTileState* mts,
TileManagerBin new_tree_bin,
WhichTree tree);
scoped_ptr<Value> GetMemoryRequirementsAsValue() const;
@@ -207,13 +215,13 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
GlobalStateThatImpactsTilePriority global_state_;
- typedef std::vector<Tile*> TileVector;
- typedef std::set<Tile*> TileSet;
+ typedef std::vector<ManagedTileState*> TileVector;
+ typedef std::set<ManagedTileState*> TileSet;
TileSet all_tiles_;
TileVector live_or_allocated_tiles_;
TileVector tiles_that_need_to_be_rasterized_;
- typedef std::list<Tile*> TileList;
+ typedef std::list<ManagedTileState*> TileList;
// Tiles with image decoding tasks. These tiles need to be rasterized
// when all the image decoding tasks finish.
TileList tiles_with_image_decoding_tasks_;
@@ -221,7 +229,7 @@ class CC_EXPORT TileManager : public WorkerPoolClient {
typedef base::hash_map<uint32_t, skia::LazyPixelRef*> PixelRefMap;
PixelRefMap pending_decode_tasks_;
- typedef std::queue<scoped_refptr<Tile> > TileQueue;
+ typedef std::queue<scoped_refptr<ManagedTileState> > TileQueue;
TileQueue tiles_with_pending_set_pixels_;
size_t bytes_pending_set_pixels_;
bool has_performed_uploads_since_last_flush_;
« no previous file with comments | « cc/tile.cc ('k') | cc/tile_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698