Index: cc/resources/tile_manager.cc |
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc |
index 4a4cfeaf27e340f9680c2260e4bdc4b92bb0aeb3..5ecc2cec04751235bd68cc1ea8e5a758a2c6b106 100644 |
--- a/cc/resources/tile_manager.cc |
+++ b/cc/resources/tile_manager.cc |
@@ -420,13 +420,6 @@ TileManager::~TileManager() { |
DCHECK_EQ(0u, bytes_releasable_); |
DCHECK_EQ(0u, resources_releasable_); |
- |
- for (std::vector<PictureLayerImpl*>::iterator it = layers_.begin(); |
- it != layers_.end(); |
- ++it) { |
- (*it)->DidUnregisterLayer(); |
- } |
- layers_.clear(); |
} |
void TileManager::Release(Tile* tile) { |
@@ -676,19 +669,6 @@ void TileManager::GetTilesWithAssignedBins(PrioritizedTileSet* tiles) { |
} |
} |
-void TileManager::CleanUpLayers() { |
- for (size_t i = 0; i < layers_.size(); ++i) { |
- if (layers_[i]->IsDrawnRenderSurfaceLayerListMember()) |
- continue; |
- |
- layers_[i]->DidUnregisterLayer(); |
- std::swap(layers_[i], layers_.back()); |
- layers_.pop_back(); |
- --i; |
- prioritized_tiles_dirty_ = true; |
- } |
-} |
- |
void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { |
TRACE_EVENT0("cc", "TileManager::ManageTiles"); |
@@ -698,8 +678,6 @@ void TileManager::ManageTiles(const GlobalStateThatImpactsTilePriority& state) { |
prioritized_tiles_dirty_ = true; |
} |
- CleanUpLayers(); |
- |
// We need to call CheckForCompletedTasks() once in-between each call |
// to ScheduleTasks() to prevent canceled tasks from being scheduled. |
if (!did_check_for_completed_tasks_since_last_schedule_tasks_) { |
@@ -1219,38 +1197,26 @@ scoped_refptr<Tile> TileManager::CreateTile(PicturePileImpl* picture_pile, |
return tile; |
} |
-void TileManager::RegisterPictureLayerImpl(PictureLayerImpl* layer) { |
- DCHECK(std::find(layers_.begin(), layers_.end(), layer) == layers_.end()); |
- layers_.push_back(layer); |
-} |
- |
-void TileManager::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
- std::vector<PictureLayerImpl*>::iterator it = |
- std::find(layers_.begin(), layers_.end(), layer); |
- DCHECK(it != layers_.end()); |
- layers_.erase(it); |
-} |
- |
void TileManager::GetPairedPictureLayers( |
reveman
2014/06/05 22:15:18
Would it be easier and more efficient to maintain
vmpstr
2014/06/05 22:38:01
You would have to update it every time there's a s
|
std::vector<PairedPictureLayer>* paired_layers) const { |
+ const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); |
+ |
paired_layers->clear(); |
// Reserve a maximum possible paired layers. |
- paired_layers->reserve(layers_.size()); |
+ paired_layers->reserve(layers.size()); |
- for (std::vector<PictureLayerImpl*>::const_iterator it = layers_.begin(); |
- it != layers_.end(); |
+ for (std::vector<PictureLayerImpl*>::const_iterator it = layers.begin(); |
+ it != layers.end(); |
++it) { |
PictureLayerImpl* layer = *it; |
- // This is a recycle tree layer, we can safely skip since the tiles on this |
- // layer have to be accessible via the active tree. |
- if (!layer->IsOnActiveOrPendingTree()) |
+ if (!layer->IsViableSourceOfRasterAndEvictionTiles()) |
continue; |
PictureLayerImpl* twin_layer = layer->GetTwinLayer(); |
- // If the twin layer is recycled, it is not a valid twin. |
- if (twin_layer && !twin_layer->IsOnActiveOrPendingTree()) |
+ // Ignore the twin layer if not a viable source of tiles. |
+ if (twin_layer && !twin_layer->IsViableSourceOfRasterAndEvictionTiles()) |
twin_layer = NULL; |
PairedPictureLayer paired_layer; |
@@ -1639,8 +1605,10 @@ void TileManager::SetRasterizerForTesting(Rasterizer* rasterizer) { |
} |
bool TileManager::IsReadyToActivate() const { |
- for (std::vector<PictureLayerImpl*>::const_iterator it = layers_.begin(); |
- it != layers_.end(); |
+ const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); |
+ |
+ for (std::vector<PictureLayerImpl*>::const_iterator it = layers.begin(); |
+ it != layers.end(); |
++it) { |
if (!(*it)->AllTilesRequiredForActivationAreReadyToDraw()) |
vmpstr
2014/06/05 22:38:01
I'm not sure you want to check all of the layers h
reveman
2014/06/06 17:27:24
Updated AllTilesRequiredForActivationAreReadyToDra
|
return false; |