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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 881083002: cc: Clean up tilings in UpdateTiles as well as in AppendQuads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove dup Created 5 years, 11 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/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 813bc47877c1f41cd803f2ab5ea4b5c9c45ec01d..60e4b4ebabd8d95f18e880296201d947f5e6f9fd 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -276,7 +276,7 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
// Keep track of the tilings that were used so that tilings that are
// unused can be considered for removal.
- std::vector<PictureLayerTiling*> seen_tilings;
+ last_append_quads_tilings_.clear();
// Ignore missing tiles outside of viewport for tile priority. This is
// normally the same as draw viewport but can be independently overridden by
@@ -403,8 +403,10 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
if (iter.resolution() != LOW_RESOLUTION)
only_used_low_res_last_append_quads_ = false;
- if (seen_tilings.empty() || seen_tilings.back() != iter.CurrentTiling())
- seen_tilings.push_back(iter.CurrentTiling());
+ if (last_append_quads_tilings_.empty() ||
+ last_append_quads_tilings_.back() != iter.CurrentTiling()) {
+ last_append_quads_tilings_.push_back(iter.CurrentTiling());
+ }
}
if (missing_tile_count) {
@@ -421,7 +423,7 @@ void PictureLayerImpl::AppendQuads(RenderPass* render_pass,
// that this is at the expense of doing cause more frequent re-painting. A
// better scheme would be to maintain a tighter visible_content_rect for the
// finer tilings.
- CleanUpTilingsOnActiveLayer(seen_tilings);
+ CleanUpTilingsOnActiveLayer(last_append_quads_tilings_);
}
bool PictureLayerImpl::UpdateTiles(const Occlusion& occlusion_in_content_space,
@@ -442,6 +444,14 @@ bool PictureLayerImpl::UpdateTiles(const Occlusion& occlusion_in_content_space,
return false;
}
+ // Remove any non-ideal tilings that were not used last time we generated
+ // quads to save memory and processing time. Note that pending tree should
+ // only have one or two tilings (high and low res), so only clean up the
+ // active layer. This cleans it up here in case AppendQuads didn't run.
+ // If it did run, this would not remove any additional tilings.
+ if (GetTree() == ACTIVE_TREE)
+ CleanUpTilingsOnActiveLayer(last_append_quads_tilings_);
+
UpdateIdealScales();
if (!raster_contents_scale_ || ShouldAdjustRasterScale()) {
@@ -460,7 +470,6 @@ bool PictureLayerImpl::UpdateTiles(const Occlusion& occlusion_in_content_space,
if (draw_transform_is_animating())
raster_source_->SetShouldAttemptToUseDistanceFieldText();
-
return UpdateTilePriorities(occlusion_in_content_space);
}
@@ -992,7 +1001,7 @@ void PictureLayerImpl::RecalculateRasterScales() {
}
void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
- std::vector<PictureLayerTiling*> used_tilings) {
+ const std::vector<PictureLayerTiling*>& used_tilings) {
DCHECK(layer_tree_impl()->IsActiveTree());
if (tilings_->num_tilings() == 0)
return;
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/picture_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698