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

Unified Diff: cc/trees/layer_tree_host_unittest_animation.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: cc/trees/layer_tree_host_unittest_animation.cc
diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc
index 22a3d554b1f093bc4aeb372a24ae23b50d632383..6eb3f4cdf6ee98f58dd69daf520a0638042e1522 100644
--- a/cc/trees/layer_tree_host_unittest_animation.cc
+++ b/cc/trees/layer_tree_host_unittest_animation.cc
@@ -144,7 +144,7 @@ class LayerTreeHostAnimationTestAddAnimation
void BeginTest() override {
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
PostAddInstantAnimationToMainThreadPlayer(player_.get());
}
@@ -185,7 +185,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws
void BeginTest() override {
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
PostAddAnimationToMainThreadPlayer(player_.get());
}
@@ -223,7 +223,7 @@ class LayerTreeHostAnimationTestAnimationsGetDeleted
void BeginTest() override {
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
PostAddAnimationToMainThreadPlayer(player_.get());
}
@@ -269,7 +269,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
layer_tree_host()->root_layer()->AddChild(picture_);
AttachPlayersToTimeline();
- player_child_->AttachElement(picture_->id());
+ player_child_->AttachElement(picture_->element_id());
}
void BeginTest() override {
@@ -335,7 +335,7 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes
AttachPlayersToTimeline();
player_child_->set_animation_delegate(this);
- player_child_->AttachElement(picture_->id());
+ player_child_->AttachElement(picture_->element_id());
}
void BeginTest() override {
@@ -389,7 +389,7 @@ class LayerTreeHostAnimationTestAnimationFinishedEvents
public:
void BeginTest() override {
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
PostAddInstantAnimationToMainThreadPlayer(player_.get());
}
@@ -425,7 +425,7 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity
LayerTreeHostAnimationTest::SetupTree();
AttachPlayersToTimeline();
- player_->AttachElement(update_check_layer_->id());
+ player_->AttachElement(update_check_layer_->element_id());
}
void BeginTest() override {
@@ -472,8 +472,8 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation
if (layer_tree_host()->source_frame_number() == 1) {
AttachPlayersToTimeline();
- scoped_refptr<Layer> layer = Layer::Create();
- player_->AttachElement(layer->id());
+ scoped_refptr<Layer> layer = CreateTestLayer();
+ player_->AttachElement(layer->element_id());
player_->set_animation_delegate(this);
// Any valid AnimationCurve will do here.
@@ -624,7 +624,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesntStartAnimations
layer_tree_host()->root_layer()->AddChild(picture_);
AttachPlayersToTimeline();
- player_child_->AttachElement(picture_->id());
+ player_child_->AttachElement(picture_->element_id());
player_child_->set_animation_delegate(this);
}
@@ -713,7 +713,7 @@ class LayerTreeHostAnimationTestScrollOffsetChangesArePropagated
layer_tree_host()->root_layer()->AddChild(scroll_layer_);
AttachPlayersToTimeline();
- player_child_->AttachElement(scroll_layer_->id());
+ player_child_->AttachElement(scroll_layer_->element_id());
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
@@ -770,7 +770,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationTakeover
layer_tree_host()->root_layer()->AddChild(scroll_layer_);
AttachPlayersToTimeline();
- player_child_->AttachElement(scroll_layer_->id());
+ player_child_->AttachElement(scroll_layer_->element_id());
// Allows NotifyAnimationTakeover to get called.
player_child_->set_animation_delegate(this);
}
@@ -789,7 +789,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationTakeover
void WillCommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
if (host_impl->sync_tree()->source_frame_number() == 0) {
host_impl->animation_host()->ImplOnlyScrollAnimationCreate(
- scroll_layer_->id(), gfx::ScrollOffset(650.f, 750.f),
+ scroll_layer_->element_id(), gfx::ScrollOffset(650.f, 750.f),
gfx::ScrollOffset(10, 20));
}
}
@@ -838,7 +838,7 @@ class LayerTreeHostAnimationTestScrollOffsetAnimationRemoval
animation->set_needs_synchronized_start_time(true);
AttachPlayersToTimeline();
- player_child_->AttachElement(scroll_layer_->id());
+ player_child_->AttachElement(scroll_layer_->element_id());
player_child_->AddAnimation(std::move(animation));
}
@@ -944,16 +944,16 @@ class LayerTreeHostAnimationTestAnimationsAddedToNewAndExistingLayers
void DidCommit() override {
if (layer_tree_host()->source_frame_number() == 1) {
- player_->AttachElement(layer_tree_host()->root_layer()->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
AddAnimatedTransformToPlayer(player_.get(), 4, 1, 1);
} else if (layer_tree_host()->source_frame_number() == 2) {
AddOpacityTransitionToPlayer(player_.get(), 1, 0.f, 0.5f, true);
- scoped_refptr<Layer> layer = Layer::Create();
+ scoped_refptr<Layer> layer = CreateTestLayer();
layer_tree_host()->root_layer()->AddChild(layer);
layer->SetBounds(gfx::Size(4, 4));
- player_child_->AttachElement(layer->id());
+ player_child_->AttachElement(layer->element_id());
player_child_->set_animation_delegate(this);
AddOpacityTransitionToPlayer(player_child_.get(), 1, 0.f, 0.5f, true);
}
@@ -1041,7 +1041,7 @@ class LayerTreeHostAnimationTestPendingTreeAnimatesFirstCommit
layer_->SetTransform(start_transform);
layer_tree_host()->root_layer()->AddChild(layer_);
- player_->AttachElement(layer_->id());
+ player_->AttachElement(layer_->element_id());
AttachPlayersToTimeline();
}
@@ -1107,13 +1107,13 @@ class LayerTreeHostAnimationTestAnimatedLayerRemovedAndAdded
public:
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- layer_ = Layer::Create();
+ layer_ = CreateTestLayer();
layer_->SetBounds(gfx::Size(4, 4));
layer_tree_host()->root_layer()->AddChild(layer_);
layer_tree_host()->animation_host()->AddAnimationTimeline(timeline_.get());
timeline_->AttachPlayer(player_.get());
- player_->AttachElement(layer_->id());
+ player_->AttachElement(layer_->element_id());
DCHECK(player_->element_animations());
AddOpacityTransitionToPlayer(player_.get(), 10000.0, 0.1f, 0.9f, true);
@@ -1189,14 +1189,14 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
public:
void SetupTree() override {
LayerTreeHostAnimationTest::SetupTree();
- layer_ = Layer::Create();
+ layer_ = CreateTestLayer();
layer_->SetBounds(gfx::Size(4, 4));
layer_tree_host()->root_layer()->AddChild(layer_);
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
- player_child_->AttachElement(layer_->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
+ player_child_->AttachElement(layer_->element_id());
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
@@ -1257,8 +1257,8 @@ class LayerTreeHostAnimationTestRemoveAnimation
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
- player_child_->AttachElement(layer_->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
+ player_child_->AttachElement(layer_->element_id());
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
@@ -1336,7 +1336,7 @@ class LayerTreeHostAnimationTestIsAnimating
layer_tree_host()->root_layer()->AddChild(layer_);
AttachPlayersToTimeline();
- player_->AttachElement(layer_->id());
+ player_->AttachElement(layer_->element_id());
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
@@ -1418,8 +1418,8 @@ class LayerTreeHostAnimationTestAnimationFinishesDuringCommit
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
- player_child_->AttachElement(layer_->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
+ player_child_->AttachElement(layer_->element_id());
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }
@@ -1492,7 +1492,7 @@ class LayerTreeHostAnimationTestNotifyAnimationFinished
layer_tree_host()->root_layer()->AddChild(picture_);
AttachPlayersToTimeline();
- player_->AttachElement(picture_->id());
+ player_->AttachElement(picture_->element_id());
player_->set_animation_delegate(this);
}
@@ -1542,7 +1542,7 @@ class LayerTreeHostAnimationTestSetPotentiallyAnimatingOnLacDestruction
LayerTreeHostAnimationTest::SetupTree();
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5);
}
@@ -1626,8 +1626,8 @@ class LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit
AttachPlayersToTimeline();
- player_->AttachElement(layer_tree_host()->root_layer()->id());
- player_child_->AttachElement(layer_->id());
+ player_->AttachElement(layer_tree_host()->root_layer()->element_id());
+ player_child_->AttachElement(layer_->element_id());
}
void BeginTest() override { PostSetNeedsCommitToMainThread(); }

Powered by Google App Engine
This is Rietveld 408576698