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

Unified Diff: cc/blimp/layer_tree_host_remote.cc

Issue 2467043002: cc/blimp: Eliminate Layer updates for common cases. (Closed)
Patch Set: 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 | « no previous file | no next file » | 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..e92685b7c28d1acd35e5496d63a1f7eb8971e263 100644
--- a/cc/blimp/layer_tree_host_remote.cc
+++ b/cc/blimp/layer_tree_host_remote.cc
@@ -29,6 +29,29 @@ 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.
ajuma 2016/11/01 19:27:58 It's true that the renderer never uses the HideLay
Khushal 2016/11/01 21:09:01 You're right, thanks! I've added that in the comme
ajuma 2016/11/01 21:37:07 Right, a mask layer shouldn't have children, the m
Khushal 2016/11/01 21:42:23 Ohh, makes sense. Would it be a good idea to add a
ajuma 2016/11/01 21:47:20 Yes, that's an excellent idea!
Khushal 2016/11/01 23:21:00 Done. :)
+ if (layer->opacity() == 0.f && layer->background_filters().IsEmpty())
+ return false;
+
+ return true;
+}
+
} // namespace
LayerTreeHostRemote::InitParams::InitParams() = default;
@@ -363,6 +386,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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698