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

Unified Diff: ui/compositor/layer.cc

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 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: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 8c8a29195c529640c22758434febfdc5e3b7ba7f..691469de7f95de744a6710c4067356ae1f1af389 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -38,6 +38,8 @@
namespace {
+static cc::ElementId g_next_element_id = 1;
+
const ui::Layer* GetRoot(const ui::Layer* layer) {
while (layer->parent())
layer = layer->parent();
@@ -147,6 +149,10 @@ void Layer::ResetCompositor() {
}
}
+cc::ElementId Layer::NextElementId() {
+ return g_next_element_id++;
+}
+
void Layer::Add(Layer* child) {
DCHECK(!child->compositor_);
if (child->parent_)
@@ -963,6 +969,7 @@ void Layer::CreateCcLayer() {
content_layer_ = cc::PictureLayer::Create(this);
cc_layer_ = content_layer_.get();
}
+ cc_layer_->SetElementId(NextElementId());
cc_layer_->SetTransformOrigin(gfx::Point3F());
cc_layer_->SetContentsOpaque(true);
cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN);

Powered by Google App Engine
This is Rietveld 408576698