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

Unified Diff: cc/layers/layer.cc

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index b02c456e77dad686bce13d86edb489d8fd33ddc1..1865815b707fcb16e38f2e47a4fe790a9d884b7e 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -15,6 +15,7 @@
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
+#include "cc/animation/animation_host.h"
#include "cc/animation/mutable_properties.h"
#include "cc/base/simple_enclosed_region.h"
#include "cc/debug/frame_viewer_instrumentation.h"
@@ -58,7 +59,6 @@ Layer::Layer()
clip_tree_index_(-1),
scroll_tree_index_(-1),
property_tree_sequence_number_(-1),
- element_id_(0),
mutable_properties_(MutableProperty::kNone),
main_thread_scrolling_reasons_(
MainThreadScrollingReason::kNotScrollingOnMain),
@@ -123,10 +123,20 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) {
layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id());
layer_tree_host_->property_trees()->needs_rebuild = true;
layer_tree_host_->UnregisterLayer(this);
+ if (element_id_) {
+ layer_tree_host_->animation_host()->UnregisterElement(
+ element_id_, ElementListType::ACTIVE);
+ layer_tree_host_->RemoveFromElementMap(this);
+ }
}
if (host) {
host->property_trees()->needs_rebuild = true;
host->RegisterLayer(this);
+ if (element_id_) {
+ host->AddToElementMap(this);
+ host->animation_host()->RegisterElement(element_id_,
+ ElementListType::ACTIVE);
+ }
}
layer_tree_host_ = host;
@@ -1804,13 +1814,26 @@ void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
benchmark->RunOnLayer(this);
}
-void Layer::SetElementId(uint64_t id) {
+void Layer::SetElementId(ElementId id) {
DCHECK(IsPropertyChangeAllowed());
if (element_id_ == id)
return;
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
- "Layer::SetElementId", "id", id);
+ "Layer::SetElementId", "element", id.AsValue().release());
+ if (element_id_ && layer_tree_host()) {
+ layer_tree_host()->animation_host()->UnregisterElement(
+ element_id_, ElementListType::ACTIVE);
+ layer_tree_host()->RemoveFromElementMap(this);
+ }
+
element_id_ = id;
+
+ if (element_id_ && layer_tree_host()) {
+ layer_tree_host()->animation_host()->RegisterElement(
+ element_id_, ElementListType::ACTIVE);
+ layer_tree_host()->AddToElementMap(this);
+ }
+
SetNeedsCommit();
}
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698