diff options
author | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 10:00:47 +0000 |
---|---|---|
committer | nduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 10:00:47 +0000 |
commit | 0f0609c313229c0ea50124196ec9f94a5609e1da (patch) | |
tree | 1666f592a2a418e76cebed7fee8f1a4e99ebb1c3 /cc/tile_manager.h | |
parent | e845e0a9224b35fbc58202376299dca4ac853594 (diff) | |
download | chromium_src-0f0609c313229c0ea50124196ec9f94a5609e1da.zip chromium_src-0f0609c313229c0ea50124196ec9f94a5609e1da.tar.gz chromium_src-0f0609c313229c0ea50124196ec9f94a5609e1da.tar.bz2 |
First draft of TileManager's tile prioritzation system
BUG=155209
R=enne@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11417002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/tile_manager.h')
-rw-r--r-- | cc/tile_manager.h | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/cc/tile_manager.h b/cc/tile_manager.h index 3446c33..8f6bf88 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 |