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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "cc/resource_pool.h" | 12 #include "cc/resource_pool.h" |
13 #include "cc/tile_priority.h" | 13 #include "cc/tile_priority.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class SequencedWorkerPool; | 16 class SequencedWorkerPool; |
17 } | 17 } |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 | 20 |
21 class Tile; | 21 class Tile; |
22 class TileVersion; | 22 class TileVersion; |
| 23 class RenderingStats; |
23 class ResourceProvider; | 24 class ResourceProvider; |
24 | 25 |
25 class CC_EXPORT TileManagerClient { | 26 class CC_EXPORT TileManagerClient { |
26 public: | 27 public: |
27 virtual void ScheduleManageTiles() = 0; | 28 virtual void ScheduleManageTiles() = 0; |
28 virtual void ScheduleRedraw() = 0; | 29 virtual void ScheduleRedraw() = 0; |
29 | 30 |
30 protected: | 31 protected: |
31 virtual ~TileManagerClient() {} | 32 virtual ~TileManagerClient() {} |
32 }; | 33 }; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 class CC_EXPORT TileManager { | 68 class CC_EXPORT TileManager { |
68 public: | 69 public: |
69 TileManager(TileManagerClient* client, ResourceProvider *resource_provider); | 70 TileManager(TileManagerClient* client, ResourceProvider *resource_provider); |
70 virtual ~TileManager(); | 71 virtual ~TileManager(); |
71 | 72 |
72 const GlobalStateThatImpactsTilePriority& GlobalState() const { return global_
state_; } | 73 const GlobalStateThatImpactsTilePriority& GlobalState() const { return global_
state_; } |
73 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 74 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
74 | 75 |
75 void ManageTiles(); | 76 void ManageTiles(); |
76 | 77 |
| 78 void renderingStats(RenderingStats* stats); |
| 79 |
77 protected: | 80 protected: |
78 // Methods called by Tile | 81 // Methods called by Tile |
79 friend class Tile; | 82 friend class Tile; |
80 void RegisterTile(Tile*); | 83 void RegisterTile(Tile*); |
81 void UnregisterTile(Tile*); | 84 void UnregisterTile(Tile*); |
82 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority
); | 85 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority
); |
83 | 86 |
84 private: | 87 private: |
85 void AssignGpuMemoryToTiles(); | 88 void AssignGpuMemoryToTiles(); |
86 void FreeResourcesForTile(Tile*); | 89 void FreeResourcesForTile(Tile*); |
87 void ScheduleManageTiles(); | 90 void ScheduleManageTiles(); |
88 void DispatchMoreRasterTasks(); | 91 void DispatchMoreRasterTasks(); |
89 void DispatchOneRasterTask(scoped_refptr<Tile>); | 92 void DispatchOneRasterTask(scoped_refptr<Tile>); |
90 void OnRasterTaskCompleted( | 93 void OnRasterTaskCompleted( |
91 scoped_refptr<Tile>, | 94 scoped_refptr<Tile>, |
92 ResourceProvider::ResourceId, | 95 ResourceProvider::ResourceId, |
93 scoped_refptr<PicturePileImpl>); | 96 scoped_refptr<PicturePileImpl>, |
| 97 RenderingStats*); |
94 void DidFinishTileInitialization(Tile*, ResourceProvider::ResourceId); | 98 void DidFinishTileInitialization(Tile*, ResourceProvider::ResourceId); |
95 | 99 |
96 TileManagerClient* client_; | 100 TileManagerClient* client_; |
97 scoped_ptr<ResourcePool> resource_pool_; | 101 scoped_ptr<ResourcePool> resource_pool_; |
98 bool manage_tiles_pending_; | 102 bool manage_tiles_pending_; |
99 int pending_raster_tasks_; | 103 int pending_raster_tasks_; |
100 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 104 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
101 | 105 |
102 GlobalStateThatImpactsTilePriority global_state_; | 106 GlobalStateThatImpactsTilePriority global_state_; |
103 | 107 |
104 typedef std::vector<Tile*> TileVector; | 108 typedef std::vector<Tile*> TileVector; |
105 TileVector tiles_; | 109 TileVector tiles_; |
106 TileVector tiles_that_need_to_be_rasterized_; | 110 TileVector tiles_that_need_to_be_rasterized_; |
| 111 |
| 112 RenderingStats rendering_stats_; |
107 }; | 113 }; |
108 | 114 |
109 } // namespace cc | 115 } // namespace cc |
110 | 116 |
111 #endif // CC_TILE_MANAGER_H_ | 117 #endif // CC_TILE_MANAGER_H_ |
OLD | NEW |