summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorskaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-02 23:09:50 +0000
committerskaslev@chromium.org <skaslev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-02 23:09:50 +0000
commit1d5344cb344def3e530c8dcac6f50bb1da45e64e (patch)
treec12f4d75b53f8ba51fa63ba5bde21191ff79e652 /cc
parent9e4f8a299e06fe223e711a90171618b9279526ae (diff)
downloadchromium_src-1d5344cb344def3e530c8dcac6f50bb1da45e64e.zip
chromium_src-1d5344cb344def3e530c8dcac6f50bb1da45e64e.tar.gz
chromium_src-1d5344cb344def3e530c8dcac6f50bb1da45e64e.tar.bz2
[CC] Skip tiles in the NEVER_BIN (on both trees) and free their resources early .
R=vmpstr BUG=264410 Review URL: https://chromiumcodereview.appspot.com/21623003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/resources/tile_manager.cc31
-rw-r--r--cc/resources/tile_manager.h4
-rw-r--r--cc/test/fake_tile_manager.cc2
3 files changed, 21 insertions, 16 deletions
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 3594875..b014aed1 100644
--- a/cc/resources/tile_manager.cc
+++ b/cc/resources/tile_manager.cc
@@ -271,13 +271,18 @@ class BinComparator {
}
};
-void TileManager::AssignBinsToTiles(TileRefVector* tiles) {
+void TileManager::GetTilesWithAssignedBins(TileRefVector* tiles) {
+ TRACE_EVENT0("cc", "TileManager::GetTilesWithAssignedBins");
+
+ DCHECK_EQ(0u, tiles->size());
+ tiles->reserve(tiles_.size());
+
const TileMemoryLimitPolicy memory_policy = global_state_.memory_limit_policy;
const TreePriority tree_priority = global_state_.tree_priority;
// For each tree, bin into different categories of tiles.
- for (TileRefVector::iterator it = tiles->begin(); it != tiles->end(); ++it) {
- Tile* tile = it->get();
+ for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ Tile* tile = it->second;
ManagedTileState& mts = tile->managed_state();
TilePriority prio[NUM_BIN_PRIORITIES];
@@ -320,6 +325,12 @@ void TileManager::AssignBinsToTiles(TileRefVector* tiles) {
mts.visible_and_ready_to_draw =
mts.tree_bin[ACTIVE_TREE] == NOW_BIN && tile->IsReadyToDraw();
+
+ // Skip and free resources for tiles in the NEVER_BIN on both trees.
+ if (mts.is_in_never_bin_on_both_trees())
+ FreeResourcesForTile(tile);
+ else
+ tiles->push_back(make_scoped_refptr(tile));
}
}
@@ -330,16 +341,10 @@ void TileManager::SortTiles(TileRefVector* tiles) {
std::sort(tiles->begin(), tiles->end(), BinComparator());
}
-void TileManager::GetSortedTiles(TileRefVector* tiles) {
- TRACE_EVENT0("cc", "TileManager::GetSortedTiles");
-
- DCHECK_EQ(0u, tiles->size());
-
- tiles->reserve(tiles_.size());
- for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it)
- tiles->push_back(make_scoped_refptr(it->second));
+void TileManager::GetSortedTilesWithAssignedBins(TileRefVector* tiles) {
+ TRACE_EVENT0("cc", "TileManager::GetSortedTilesWithAssignedBins");
- AssignBinsToTiles(tiles);
+ GetTilesWithAssignedBins(tiles);
SortTiles(tiles);
}
@@ -349,7 +354,7 @@ void TileManager::ManageTiles() {
// Clear |sorted_tiles_| so that tiles kept alive by it can be freed.
sorted_tiles_.clear();
- GetSortedTiles(&sorted_tiles_);
+ GetSortedTilesWithAssignedBins(&sorted_tiles_);
TileVector tiles_that_need_to_be_rasterized;
AssignGpuMemoryToTiles(sorted_tiles_, &tiles_that_need_to_be_rasterized);
diff --git a/cc/resources/tile_manager.h b/cc/resources/tile_manager.h
index 15bb5cc..f6f5785 100644
--- a/cc/resources/tile_manager.h
+++ b/cc/resources/tile_manager.h
@@ -108,9 +108,9 @@ class CC_EXPORT TileManager : public RasterWorkerPoolClient {
void AssignGpuMemoryToTiles(
const TileRefVector& sorted_tiles,
TileVector* tiles_that_need_to_be_rasterized);
- void AssignBinsToTiles(TileRefVector* tiles);
+ void GetTilesWithAssignedBins(TileRefVector* tiles);
void SortTiles(TileRefVector* tiles);
- void GetSortedTiles(TileRefVector* tiles);
+ void GetSortedTilesWithAssignedBins(TileRefVector* tiles);
private:
void OnImageDecodeTaskCompleted(
diff --git a/cc/test/fake_tile_manager.cc b/cc/test/fake_tile_manager.cc
index c1b61f3..e302a23 100644
--- a/cc/test/fake_tile_manager.cc
+++ b/cc/test/fake_tile_manager.cc
@@ -44,7 +44,7 @@ void FakeTileManager::AssignMemoryToTiles() {
tiles_for_raster.clear();
all_tiles.clear();
- GetSortedTiles(&all_tiles);
+ GetSortedTilesWithAssignedBins(&all_tiles);
AssignGpuMemoryToTiles(all_tiles, &tiles_for_raster);
}