diff options
author | vmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 23:15:24 +0000 |
---|---|---|
committer | vmpstr@chromium.org <vmpstr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-08 23:15:24 +0000 |
commit | d27e2e14674fa6158e33e09282e35b3234ad7bc0 (patch) | |
tree | f5e7b2ef7defdf74c46bc51a9b1c8fdac573c9a1 /cc | |
parent | 15dd567616b82d056a7707c12ac9683dd8cee49f (diff) | |
download | chromium_src-d27e2e14674fa6158e33e09282e35b3234ad7bc0.zip chromium_src-d27e2e14674fa6158e33e09282e35b3234ad7bc0.tar.gz chromium_src-d27e2e14674fa6158e33e09282e35b3234ad7bc0.tar.bz2 |
cc: Eliminate managed_tile_state dependency on tile_manager.h
This change moves TileManagerBin* to mts and renames it to
ManagedTileBin*. This eliminates the dependency and allows
tile_manager.h to include tile.h
BUG=258100
Review URL: https://chromiumcodereview.appspot.com/18242006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/resources/managed_tile_state.cc | 43 | ||||
-rw-r--r-- | cc/resources/managed_tile_state.h | 29 | ||||
-rw-r--r-- | cc/resources/tile_manager.cc | 43 | ||||
-rw-r--r-- | cc/resources/tile_manager.h | 24 |
4 files changed, 70 insertions, 69 deletions
diff --git a/cc/resources/managed_tile_state.cc b/cc/resources/managed_tile_state.cc index 578fb31..b496a78 100644 --- a/cc/resources/managed_tile_state.cc +++ b/cc/resources/managed_tile_state.cc @@ -10,6 +10,43 @@ namespace cc { +scoped_ptr<base::Value> ManagedTileBinAsValue(ManagedTileBin bin) { + switch (bin) { + case NOW_BIN: + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "NOW_BIN")); + case SOON_BIN: + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "SOON_BIN")); + case EVENTUALLY_BIN: + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "EVENTUALLY_BIN")); + case NEVER_BIN: + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "NEVER_BIN")); + default: + DCHECK(false) << "Unrecognized ManagedTileBin value " << bin; + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "<unknown ManagedTileBin value>")); + } +} + +scoped_ptr<base::Value> ManagedTileBinPriorityAsValue( + ManagedTileBinPriority bin_priority) { + switch (bin_priority) { + case HIGH_PRIORITY_BIN: + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "HIGH_PRIORITY_BIN")); + case LOW_PRIORITY_BIN: + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "LOW_PRIORITY_BIN")); + default: + DCHECK(false) << "Unrecognized ManagedTileBinPriority value"; + return scoped_ptr<base::Value>(base::Value::CreateStringValue( + "<unknown ManagedTileBinPriority value>")); + } +} + ManagedTileState::ManagedTileState() : raster_mode(LOW_QUALITY_RASTER_MODE), gpu_memmgr_stats_bin(NEVER_BIN), @@ -58,10 +95,10 @@ scoped_ptr<base::Value> ManagedTileState::AsValue() const { scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); state->SetBoolean("has_resource", tile_versions[raster_mode].resource_.get() != 0); - state->Set("bin.0", TileManagerBinAsValue(bin[ACTIVE_TREE]).release()); - state->Set("bin.1", TileManagerBinAsValue(bin[PENDING_TREE]).release()); + state->Set("bin.0", ManagedTileBinAsValue(bin[ACTIVE_TREE]).release()); + state->Set("bin.1", ManagedTileBinAsValue(bin[PENDING_TREE]).release()); state->Set("gpu_memmgr_stats_bin", - TileManagerBinAsValue(bin[ACTIVE_TREE]).release()); + ManagedTileBinAsValue(bin[ACTIVE_TREE]).release()); state->Set("resolution", TileResolutionAsValue(resolution).release()); state->Set("time_to_needed_in_seconds", MathUtil::AsValueSafely(time_to_needed_in_seconds).release()); diff --git a/cc/resources/managed_tile_state.h b/cc/resources/managed_tile_state.h index c76838d..6959f1d 100644 --- a/cc/resources/managed_tile_state.h +++ b/cc/resources/managed_tile_state.h @@ -10,10 +10,31 @@ #include "cc/resources/raster_worker_pool.h" #include "cc/resources/resource_pool.h" #include "cc/resources/resource_provider.h" -#include "cc/resources/tile_manager.h" namespace cc { +class TileManager; + +// Tile manager classifying tiles into a few basic bins: +enum ManagedTileBin { + 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 + // Be sure to update ManagedTileBinAsValue when adding new fields. +}; +scoped_ptr<base::Value> ManagedTileBinAsValue( + ManagedTileBin bin); + +enum ManagedTileBinPriority { + HIGH_PRIORITY_BIN = 0, + LOW_PRIORITY_BIN = 1, + NUM_BIN_PRIORITIES = 2 +}; +scoped_ptr<base::Value> ManagedTileBinPriorityAsValue( + ManagedTileBinPriority bin); + // This is state that is specific to a tile that is // managed by the TileManager. class CC_EXPORT ManagedTileState { @@ -122,13 +143,13 @@ class CC_EXPORT ManagedTileState { bin[LOW_PRIORITY_BIN] == NOW_BIN; } - TileManagerBin bin[NUM_BIN_PRIORITIES]; - TileManagerBin tree_bin[NUM_TREES]; + ManagedTileBin bin[NUM_BIN_PRIORITIES]; + ManagedTileBin tree_bin[NUM_TREES]; // The bin that the tile would have if the GPU memory manager had // a maximally permissive policy, send to the GPU memory manager // to determine policy. - TileManagerBin gpu_memmgr_stats_bin; + ManagedTileBin gpu_memmgr_stats_bin; TileResolution resolution; bool required_for_activation; float time_to_needed_in_seconds; diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc index 1d25142..f707573c 100644 --- a/cc/resources/tile_manager.cc +++ b/cc/resources/tile_manager.cc @@ -26,7 +26,7 @@ namespace { // Determine bin based on three categories of tiles: things we need now, // things we need soon, and eventually. -inline TileManagerBin BinFromTilePriority(const TilePriority& prio, +inline ManagedTileBin BinFromTilePriority(const TilePriority& prio, TreePriority tree_priority) { // The amount of time for which we want to have prepainting coverage. const float kPrepaintingWindowTimeSeconds = 1.0f; @@ -56,43 +56,6 @@ inline TileManagerBin BinFromTilePriority(const TilePriority& prio, } // namespace -scoped_ptr<base::Value> TileManagerBinAsValue(TileManagerBin bin) { - switch (bin) { - case NOW_BIN: - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "NOW_BIN")); - case SOON_BIN: - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "SOON_BIN")); - case EVENTUALLY_BIN: - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "EVENTUALLY_BIN")); - case NEVER_BIN: - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "NEVER_BIN")); - default: - DCHECK(false) << "Unrecognized TileManagerBin value " << bin; - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "<unknown TileManagerBin value>")); - } -} - -scoped_ptr<base::Value> TileManagerBinPriorityAsValue( - TileManagerBinPriority bin_priority) { - switch (bin_priority) { - case HIGH_PRIORITY_BIN: - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "HIGH_PRIORITY_BIN")); - case LOW_PRIORITY_BIN: - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "LOW_PRIORITY_BIN")); - default: - DCHECK(false) << "Unrecognized TileManagerBinPriority value"; - return scoped_ptr<base::Value>(base::Value::CreateStringValue( - "<unknown TileManagerBinPriority value>")); - } -} - // static scoped_ptr<TileManager> TileManager::Create( TileManagerClient* client, @@ -263,7 +226,7 @@ void TileManager::AssignBinsToTiles() { const TreePriority tree_priority = global_state_.tree_priority; // Memory limit policy works by mapping some bin states to the NEVER bin. - TileManagerBin bin_map[NUM_BINS]; + ManagedTileBin bin_map[NUM_BINS]; if (global_state_.memory_limit_policy == ALLOW_NOTHING) { bin_map[NOW_BIN] = NEVER_BIN; bin_map[SOON_BIN] = NEVER_BIN; @@ -873,7 +836,7 @@ void TileManager::DidFinishTileInitialization(Tile* tile) { } void TileManager::DidTileTreeBinChange(Tile* tile, - TileManagerBin new_tree_bin, + ManagedTileBin new_tree_bin, WhichTree tree) { ManagedTileState& mts = tile->managed_state(); mts.tree_bin[tree] = new_tree_bin; diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h index 402bc3a..ab724fe 100644 --- a/cc/resources/tile_manager.h +++ b/cc/resources/tile_manager.h @@ -13,6 +13,7 @@ #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "cc/debug/rendering_stats_instrumentation.h" +#include "cc/resources/managed_tile_state.h" #include "cc/resources/memory_history.h" #include "cc/resources/picture_pile_impl.h" #include "cc/resources/raster_worker_pool.h" @@ -32,27 +33,6 @@ class CC_EXPORT 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 - // Be sure to update TileManagerBinAsValue when adding new fields. -}; -scoped_ptr<base::Value> TileManagerBinAsValue( - TileManagerBin bin); - -enum TileManagerBinPriority { - HIGH_PRIORITY_BIN = 0, - LOW_PRIORITY_BIN = 1, - NUM_BIN_PRIORITIES = 2 -}; -scoped_ptr<base::Value> TileManagerBinPriorityAsValue( - TileManagerBinPriority bin); - // 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 @@ -143,7 +123,7 @@ class CC_EXPORT TileManager : public RasterWorkerPoolClient { RasterWorkerPool::RasterTask CreateRasterTask(Tile* tile); void DidFinishTileInitialization(Tile* tile); void DidTileTreeBinChange(Tile* tile, - TileManagerBin new_tree_bin, + ManagedTileBin new_tree_bin, WhichTree tree); scoped_ptr<base::Value> GetMemoryRequirementsAsValue() const; void AddRequiredTileForActivation(Tile* tile); |