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 <queue> |
8 #include <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "cc/resource_pool.h" | 13 #include "cc/resource_pool.h" |
13 #include "cc/tile_priority.h" | 14 #include "cc/tile_priority.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 class RasterThread; | 18 class RasterThread; |
18 class ResourceProvider; | 19 class ResourceProvider; |
19 class Tile; | 20 class Tile; |
20 class TileVersion; | 21 class TileVersion; |
21 struct RenderingStats; | 22 struct RenderingStats; |
22 | 23 |
23 class CC_EXPORT TileManagerClient { | 24 class CC_EXPORT TileManagerClient { |
24 public: | 25 public: |
25 virtual void ScheduleManageTiles() = 0; | 26 virtual void ScheduleManageTiles() = 0; |
26 virtual void ScheduleRedraw() = 0; | 27 virtual void ScheduleCheckForCompletedSetPixels() = 0; |
27 | 28 |
28 protected: | 29 protected: |
29 virtual ~TileManagerClient() {} | 30 virtual ~TileManagerClient() {} |
30 }; | 31 }; |
31 | 32 |
32 // Tile manager classifying tiles into a few basic | 33 // Tile manager classifying tiles into a few basic |
33 // bins: | 34 // bins: |
34 enum TileManagerBin { | 35 enum TileManagerBin { |
35 NOW_BIN = 0, // Needed ASAP. | 36 NOW_BIN = 0, // Needed ASAP. |
36 SOON_BIN = 1, // Impl-side version of prepainting. | 37 SOON_BIN = 1, // Impl-side version of prepainting. |
(...skipping 30 matching lines...) Expand all Loading... |
67 public: | 68 public: |
68 TileManager(TileManagerClient* client, | 69 TileManager(TileManagerClient* client, |
69 ResourceProvider *resource_provider, | 70 ResourceProvider *resource_provider, |
70 size_t num_raster_threads); | 71 size_t num_raster_threads); |
71 virtual ~TileManager(); | 72 virtual ~TileManager(); |
72 | 73 |
73 const GlobalStateThatImpactsTilePriority& GlobalState() const { return global_
state_; } | 74 const GlobalStateThatImpactsTilePriority& GlobalState() const { return global_
state_; } |
74 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); | 75 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
75 | 76 |
76 void ManageTiles(); | 77 void ManageTiles(); |
| 78 void CheckForCompletedSetPixels(); |
77 | 79 |
78 void renderingStats(RenderingStats* stats); | 80 void renderingStats(RenderingStats* stats); |
79 | 81 |
80 protected: | 82 protected: |
81 // Methods called by Tile | 83 // Methods called by Tile |
82 friend class Tile; | 84 friend class Tile; |
83 void RegisterTile(Tile*); | 85 void RegisterTile(Tile*); |
84 void UnregisterTile(Tile*); | 86 void UnregisterTile(Tile*); |
85 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority
); | 87 void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority
); |
86 | 88 |
87 private: | 89 private: |
88 void AssignGpuMemoryToTiles(); | 90 void AssignGpuMemoryToTiles(); |
89 void FreeResourcesForTile(Tile*); | 91 void FreeResourcesForTile(Tile*); |
90 void ScheduleManageTiles(); | 92 void ScheduleManageTiles(); |
| 93 void ScheduleCheckForCompletedSetPixels(); |
91 void DispatchMoreRasterTasks(); | 94 void DispatchMoreRasterTasks(); |
92 void DispatchOneRasterTask(RasterThread*, scoped_refptr<Tile>); | 95 void DispatchOneRasterTask(RasterThread*, scoped_refptr<Tile>); |
93 void OnRasterTaskCompleted( | 96 void OnRasterTaskCompleted( |
94 scoped_refptr<Tile>, | 97 scoped_refptr<Tile>, |
95 scoped_ptr<ResourcePool::Resource>, | 98 scoped_ptr<ResourcePool::Resource>, |
96 scoped_refptr<PicturePileImpl>, | 99 scoped_refptr<PicturePileImpl>, |
97 RenderingStats*); | 100 RenderingStats*); |
98 void DidFinishTileInitialization(Tile*, scoped_ptr<ResourcePool::Resource>); | 101 void DidFinishTileInitialization(Tile*); |
99 | 102 |
100 TileManagerClient* client_; | 103 TileManagerClient* client_; |
101 scoped_ptr<ResourcePool> resource_pool_; | 104 scoped_ptr<ResourcePool> resource_pool_; |
102 bool manage_tiles_pending_; | 105 bool manage_tiles_pending_; |
| 106 bool check_for_completed_set_pixels_pending_; |
103 | 107 |
104 GlobalStateThatImpactsTilePriority global_state_; | 108 GlobalStateThatImpactsTilePriority global_state_; |
105 | 109 |
106 typedef std::vector<Tile*> TileVector; | 110 typedef std::vector<Tile*> TileVector; |
107 TileVector tiles_; | 111 TileVector tiles_; |
108 TileVector tiles_that_need_to_be_rasterized_; | 112 TileVector tiles_that_need_to_be_rasterized_; |
109 | 113 |
| 114 typedef std::queue<scoped_refptr<Tile> > TileQueue; |
| 115 TileQueue tiles_with_pending_set_pixels_; |
| 116 |
110 typedef ScopedPtrVector<RasterThread> RasterThreadVector; | 117 typedef ScopedPtrVector<RasterThread> RasterThreadVector; |
111 RasterThreadVector raster_threads_; | 118 RasterThreadVector raster_threads_; |
112 | 119 |
113 RenderingStats rendering_stats_; | 120 RenderingStats rendering_stats_; |
| 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(TileManager); |
114 }; | 123 }; |
115 | 124 |
116 } // namespace cc | 125 } // namespace cc |
117 | 126 |
118 #endif // CC_TILE_MANAGER_H_ | 127 #endif // CC_TILE_MANAGER_H_ |
OLD | NEW |