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

Unified Diff: cc/blimp/layer_tree_host_remote.cc

Issue 2467043002: cc/blimp: Eliminate Layer updates for common cases. (Closed)
Patch Set: test update Created 4 years, 1 month 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/blimp/compositor_state_deserializer_unittest.cc ('k') | cc/blimp/layer_tree_host_remote_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/blimp/layer_tree_host_remote.cc
diff --git a/cc/blimp/layer_tree_host_remote.cc b/cc/blimp/layer_tree_host_remote.cc
index b5d129f98fa96827229497c63be9b1e9ae1afbf5..fb7439b55a69df6fd6009310db856a1e09032537 100644
--- a/cc/blimp/layer_tree_host_remote.cc
+++ b/cc/blimp/layer_tree_host_remote.cc
@@ -29,6 +29,31 @@ namespace {
base::TimeDelta kDefaultFrameInterval = base::TimeDelta::FromMilliseconds(16);
static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number;
+
+bool ShouldUpdateLayer(Layer* layer) {
+ // If the embedder has marked the layer as non-drawable.
+ if (!layer->DrawsContent())
+ return false;
+
+ // If the layer bounds are empty.
+ if (layer->bounds().IsEmpty())
+ return false;
+
+ // If the layer is transparent and has no background filters applied.
+ // See EffectTree::UpdateIsDrawn for the logic details.
+ // A few things have been ignored:
+ // 1) We don't support threaded animations at the moment, so the opacity can
+ // not change on the client.
+ // 2) This does not account for layer hiding its subtree, but that is never
+ // used by the renderer.
+ // 3) Also updates a transparent layer's subtree when it will be skipped while
+ // drawing on the client.
+ if (layer->opacity() == 0.f && layer->background_filters().IsEmpty())
+ return false;
+
+ return true;
+}
+
} // namespace
LayerTreeHostRemote::InitParams::InitParams() = default;
@@ -363,6 +388,8 @@ void LayerTreeHostRemote::BeginMainFrame() {
// layers. See crbug.com/650885.
LayerTreeHostCommon::CallFunctionForEveryLayer(
layer_tree_.get(), [&layer_list](Layer* layer) {
+ if (!ShouldUpdateLayer(layer))
+ return;
layer->SavePaintProperties();
layer_list.push_back(layer);
});
« no previous file with comments | « cc/blimp/compositor_state_deserializer_unittest.cc ('k') | cc/blimp/layer_tree_host_remote_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698