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

Unified Diff: cc/resources/picture_layer_tiling_set.cc

Issue 874613003: cc: Stop pushing properties every activation for picture layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: cc/resources/picture_layer_tiling_set.cc
diff --git a/cc/resources/picture_layer_tiling_set.cc b/cc/resources/picture_layer_tiling_set.cc
index 779e2c08e9e6d994b9f4f7e9c25635c42efc8662..bae9df9ff21c0353441040355518767af50e755d 100644
--- a/cc/resources/picture_layer_tiling_set.cc
+++ b/cc/resources/picture_layer_tiling_set.cc
@@ -62,6 +62,8 @@ void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSource(
RemoveTilingsBelowScale(minimum_contents_scale);
RemoveTilingsAboveScale(maximum_contents_scale);
+ bool added_tiling = false;
+
// Copy over tilings that are shared with the |twin_set| tiling set (if it
// exists).
if (twin_set) {
@@ -78,6 +80,7 @@ void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSource(
skewport_extrapolation_limit_in_content_pixels_);
tilings_.push_back(new_tiling.Pass());
this_tiling = tilings_.back();
+ added_tiling = true;
}
this_tiling->CloneTilesAndPropertiesFrom(*twin_tiling);
}
@@ -127,6 +130,9 @@ void PictureLayerTilingSet::UpdateTilingsToCurrentRasterSource(
DCHECK_EQ(1u, num_high_res);
}
#endif
+
+ if (added_tiling)
+ client_->TilingSetChanged();
}
void PictureLayerTilingSet::CleanUpTilings(
@@ -187,7 +193,10 @@ void PictureLayerTilingSet::RemoveNonIdealTilings() {
auto to_remove = tilings_.remove_if([](PictureLayerTiling* t) {
return t->resolution() == NON_IDEAL_RESOLUTION;
});
+ bool removed_anything = to_remove != tilings_.end();
tilings_.erase(to_remove, tilings_.end());
+ if (removed_anything)
+ client_->TilingSetChanged();
}
void PictureLayerTilingSet::MarkAllTilingsNonIdeal() {
@@ -208,8 +217,9 @@ PictureLayerTiling* PictureLayerTilingSet::AddTiling(
skewport_target_time_in_seconds_,
skewport_extrapolation_limit_in_content_pixels_));
PictureLayerTiling* appended = tilings_.back();
-
tilings_.sort(LargestToSmallestScaleFunctor());
+
+ client_->TilingSetChanged();
return appended;
}
@@ -247,7 +257,10 @@ void PictureLayerTilingSet::RemoveTilingsBelowScale(float minimum_scale) {
tilings_.remove_if([minimum_scale](PictureLayerTiling* tiling) {
return tiling->contents_scale() < minimum_scale;
});
+ bool removed_anything = to_remove != tilings_.end();
tilings_.erase(to_remove, tilings_.end());
+ if (removed_anything)
+ client_->TilingSetChanged();
}
void PictureLayerTilingSet::RemoveTilingsAboveScale(float maximum_scale) {
@@ -255,11 +268,17 @@ void PictureLayerTilingSet::RemoveTilingsAboveScale(float maximum_scale) {
tilings_.remove_if([maximum_scale](PictureLayerTiling* tiling) {
return tiling->contents_scale() > maximum_scale;
});
+ bool removed_anything = to_remove != tilings_.end();
tilings_.erase(to_remove, tilings_.end());
+ if (removed_anything)
+ client_->TilingSetChanged();
}
void PictureLayerTilingSet::RemoveAllTilings() {
+ bool removed_anything = !tilings_.empty();
tilings_.clear();
+ if (removed_anything)
+ client_->TilingSetChanged();
}
void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) {
@@ -268,6 +287,7 @@ void PictureLayerTilingSet::Remove(PictureLayerTiling* tiling) {
if (iter == tilings_.end())
return;
tilings_.erase(iter);
+ client_->TilingSetChanged();
}
void PictureLayerTilingSet::RemoveAllTiles() {

Powered by Google App Engine
This is Rietveld 408576698