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

Unified Diff: cc/resources/tile_manager.cc

Issue 322443002: cc: Refactor how picture layers are exposed to the tile manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tile manager perf tests Created 6 years, 6 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/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/tile_manager.cc
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc
index 4a4cfeaf27e340f9680c2260e4bdc4b92bb0aeb3..c96b5e27ffc643c55b808f524eb9054fff9c677a 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,28 @@ 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(
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())
+ // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704
+ if (!layer->HasValidTilePriorities())
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 when tile priorities are invalid.
+ // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704
+ if (twin_layer && !twin_layer->HasValidTilePriorities())
twin_layer = NULL;
PairedPictureLayer paired_layer;
@@ -1450,6 +1418,8 @@ bool TileManager::RasterTileIterator::RasterOrderComparator::operator()(
// If the bin is the same but the resolution is not, then the order will be
// determined by whether we prioritize low res or not.
+ // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile
+ // class but instead produced by the iterators.
if (b_priority.priority_bin == a_priority.priority_bin &&
b_priority.resolution != a_priority.resolution) {
// Non ideal resolution should be sorted lower than other resolutions.
@@ -1639,8 +1609,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())
return false;
« no previous file with comments | « cc/resources/tile_manager.h ('k') | cc/resources/tile_manager_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698