Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4738)

Unified Diff: cc/tile_manager.cc

Issue 12213019: Creates a live_tile_ list that manages live tiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tile_manager.cc
diff --git a/cc/tile_manager.cc b/cc/tile_manager.cc
index 83c0ab2b235d2f557631804d14967b174ae1e1bb..ab9cc739ce1ddf540c6dfaeffe692c30ef475fae 100644
--- a/cc/tile_manager.cc
+++ b/cc/tile_manager.cc
@@ -143,7 +143,8 @@ TileManager::~TileManager() {
raster_worker_pool_.reset();
CheckForCompletedTileUploads();
DCHECK(tiles_with_pending_set_pixels_.size() == 0);
- DCHECK(tiles_.size() == 0);
+ DCHECK(all_tiles_.size() == 0);
+ DCHECK(live_tiles_.size() == 0);
reveman 2013/02/05 19:31:09 do you mind changing all these checks to DCHECK_EQ
}
void TileManager::SetGlobalState(
@@ -154,7 +155,7 @@ void TileManager::SetGlobalState(
}
void TileManager::RegisterTile(Tile* tile) {
- tiles_.push_back(tile);
+ all_tiles_.push_back(tile);
const ManagedTileState& mts = tile->managed_state();
for (int i = 0; i < NUM_TREES; ++i)
@@ -178,13 +179,21 @@ void TileManager::UnregisterTile(Tile* tile) {
break;
}
}
- for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); it++) {
+ for (TileVector::iterator it = live_tiles_.begin();
+ it != live_tiles_.end(); it++) {
+ if (*it == tile) {
+ live_tiles_.erase(it);
+ break;
+ }
+ }
+ for (TileVector::iterator it = all_tiles_.begin();
+ it != all_tiles_.end(); it++) {
if (*it == tile) {
const ManagedTileState& mts = tile->managed_state();
for (int i = 0; i < NUM_TREES; ++i)
--raster_state_count_[mts.raster_state][i][mts.tree_bin[i]];
FreeResourcesForTile(tile);
- tiles_.erase(it);
+ all_tiles_.erase(it);
return;
}
}
@@ -220,7 +229,7 @@ void TileManager::SortTiles() {
TRACE_EVENT0("cc", "TileManager::SortTiles");
// Sort by bin, resolution and time until needed.
- std::sort(tiles_.begin(), tiles_.end(), BinComparator());
+ std::sort(live_tiles_.begin(), live_tiles_.end(), BinComparator());
}
void TileManager::ManageTiles() {
@@ -229,10 +238,21 @@ void TileManager::ManageTiles() {
++manage_tiles_call_count_;
const TreePriority tree_priority = global_state_.tree_priority;
- TRACE_COUNTER_ID1("cc", "TileCount", this, tiles_.size());
+ TRACE_COUNTER_ID1("cc", "AllTileCount", this, all_tiles_.size());
+
+ live_tiles_.resize(0);
reveman 2013/02/05 19:31:09 nit: use live_tiles_.erase(live_tiles_.begin(), li
whunt 2013/02/05 22:00:00 I believe that resize(0) is faster but probably no
reveman 2013/02/05 22:16:41 sg, we can change all this to resize(0) later.
+ for (TileVector::iterator it = all_tiles_.begin();
+ it != all_tiles_.end(); ++it) {
+ if ((*it)->priority( ACTIVE_TREE).is_live ||
reveman 2013/02/05 19:31:09 nit: I like when things align but not sure the cod
whunt 2013/02/05 22:00:00 If the system doesn't bounce it and you don't boun
+ (*it)->priority(PENDING_TREE).is_live)
reveman 2013/02/05 19:31:09 should we be using (*it)->combined_priority().is_l
whunt 2013/02/05 22:00:00 To be honest, I have no idea, should we?. I'm hap
reveman 2013/02/05 22:16:41 the result is the same right now. look at "TilePri
+ live_tiles_.push_back(*it);
+ }
+
+ TRACE_COUNTER_ID1("cc", "LiveTileCount", this, live_tiles_.size());
// For each tree, bin into different categories of tiles.
- for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ for (TileVector::iterator it = live_tiles_.begin();
+ it != live_tiles_.end(); ++it) {
Tile* tile = *it;
ManagedTileState& mts = tile->managed_state();
@@ -290,7 +310,8 @@ void TileManager::ManageTiles() {
bin_map[EVENTUALLY_BIN] = EVENTUALLY_BIN;
bin_map[NEVER_BIN] = NEVER_BIN;
}
- for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ for (TileVector::iterator it = live_tiles_.begin();
+ it != live_tiles_.end(); ++it) {
Tile* tile = *it;
ManagedTileState& mts = tile->managed_state();
for (int i = 0; i < NUM_BIN_PRIORITIES; ++i)
@@ -347,8 +368,8 @@ void TileManager::GetMemoryStats(
*memoryRequiredBytes = 0;
*memoryNiceToHaveBytes = 0;
*memoryUsedBytes = 0;
- for(size_t i = 0; i < tiles_.size(); i++) {
- const Tile* tile = tiles_[i];
+ for(size_t i = 0; i < all_tiles_.size(); i++) {
reveman 2013/02/05 22:16:41 nit: you didn't introduce this but I'd be happy if
+ const Tile* tile = all_tiles_[i];
const ManagedTileState& mts = tile->managed_state();
size_t tile_bytes = tile->bytes_consumed_if_allocated();
if (mts.gpu_memmgr_stats_bin == NOW_BIN)
@@ -362,7 +383,8 @@ void TileManager::GetMemoryStats(
scoped_ptr<base::Value> TileManager::AsValue() const {
scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
- state->SetInteger("tile_count", tiles_.size());
+ state->SetInteger("all_tile_count", all_tiles_.size());
+ state->SetInteger("live_tile_count", live_tiles_.size());
state->Set("global_state", global_state_.AsValue().release());
@@ -425,7 +447,8 @@ void TileManager::AssignGpuMemoryToTiles() {
TRACE_EVENT0("cc", "TileManager::AssignGpuMemoryToTiles");
// Some memory cannot be released. Figure out which.
size_t unreleasable_bytes = 0;
- for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ for (TileVector::iterator it = live_tiles_.begin();
+ it != live_tiles_.end(); ++it) {
Tile* tile = *it;
if (!tile->managed_state().can_be_freed)
unreleasable_bytes += tile->bytes_consumed_if_allocated();
@@ -447,7 +470,8 @@ void TileManager::AssignGpuMemoryToTiles() {
// currently waiting for raster to idle state.
// Call DidTileRasterStateChange() for each of these tiles to
// have this state change take effect.
- for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ for (TileVector::iterator it = live_tiles_.begin();
+ it != live_tiles_.end(); ++it) {
Tile* tile = *it;
if (tile->managed_state().raster_state == WAITING_FOR_RASTER_STATE)
DidTileRasterStateChange(tile, IDLE_STATE);
@@ -456,7 +480,8 @@ void TileManager::AssignGpuMemoryToTiles() {
size_t bytes_allocatable = global_state_.memory_limit_in_bytes - unreleasable_bytes;
size_t bytes_that_exceeded_memory_budget = 0;
size_t bytes_left = bytes_allocatable;
- for (TileVector::iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
+ for (TileVector::iterator it = live_tiles_.begin();
+ it != live_tiles_.end(); ++it) {
Tile* tile = *it;
size_t tile_bytes = tile->bytes_consumed_if_allocated();
ManagedTileState& managed_tile_state = tile->managed_state();
« no previous file with comments | « cc/tile_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698