Index: cc/tile_manager.h |
diff --git a/cc/tile_manager.h b/cc/tile_manager.h |
index 3446c335b3260f0b8f9f4b72db618f6962b7b928..8f6bf8811b1f3083bb496c46a48e0bf08cf7971a 100644 |
--- a/cc/tile_manager.h |
+++ b/cc/tile_manager.h |
@@ -8,6 +8,7 @@ |
#include <vector> |
#include "base/values.h" |
+#include "cc/layer_tree_host_impl.h" |
#include "cc/tile_priority.h" |
namespace cc { |
@@ -24,6 +25,36 @@ class TileManagerClient { |
virtual ~TileManagerClient() {} |
}; |
+// Tile manager classifying tiles into a few basic |
+// bins: |
+enum TileManagerBin { |
+ NOW_BIN = 0, // Needed ASAP. |
+ SOON_BIN = 1, // Impl-side version of prepainting. |
+ EVENTUALLY_BIN = 2, // Nice to have, if we've got memory and time. |
+ NEVER_BIN = 3, // Dont bother. |
+ NUM_BINS = 4 |
+}; |
+ |
+// This is state that is specific to a tile that is |
+// managed by the TileManager. |
+class ManagedTileState { |
+ public: |
+ ManagedTileState() |
+ : can_use_gpu_memory(false) |
+ , resource_id(0) |
+ , resource_id_can_be_freed(0) {} |
+ |
+ // Persisted state: valid all the time. |
+ bool can_use_gpu_memory; |
+ ResourceProvider::ResourceId resource_id; |
+ bool resource_id_can_be_freed; |
+ |
+ // Ephemeral state, valid only during Manage. |
+ TileManagerBin bin; |
+ TileResolution resolution; |
+ float time_to_needed_in_seconds; |
+}; |
+ |
// This class manages tiles, deciding which should get rasterized and which |
// should no longer have any memory assigned to them. Tile objects are "owned" |
// by layers; they automatically register with the manager when they are |
@@ -38,19 +69,24 @@ class TileManager { |
protected: |
// Methods called by Tile |
- void DidCreateTileVersion(TileVersion*); |
- void WillModifyTileVersionPriority(TileVersion*, const TilePriority& new_priority); |
- void DidDeleteTileVersion(TileVersion*); |
+ friend class Tile; |
+ void RegisterTile(Tile*); |
+ void UnregisterTile(Tile*); |
+ void WillModifyTilePriority(Tile*, WhichTree, const TilePriority& new_priority); |
private: |
- friend class Tile; |
+ void FreeResourcesForTile(Tile*); |
void ScheduleManageTiles(); |
+ void ScheduleMorePaintingJobs(); |
TileManagerClient* client_; |
bool manage_tiles_pending_; |
GlobalStateThatImpactsTilePriority global_state_; |
- std::vector<TileVersion*> tile_versions_; |
+ |
+ typedef std::vector<Tile*> TileVector; |
+ TileVector tiles_; |
+ TileVector tiles_that_need_to_be_painted_; |
}; |
} // namespace cc |