diff options
author | jaydasika <jaydasika@chromium.org> | 2016-03-21 13:44:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-21 20:45:22 +0000 |
commit | 9234e405c7089c47ca9d30b34846f54b1fd9b8fd (patch) | |
tree | c338cb228c148d32e26bf08f30e965904d14ab6a /cc/trees | |
parent | 8b23772eff902cf5df76414e1998826e87fc8444 (diff) | |
download | chromium_src-9234e405c7089c47ca9d30b34846f54b1fd9b8fd.zip chromium_src-9234e405c7089c47ca9d30b34846f54b1fd9b8fd.tar.gz chromium_src-9234e405c7089c47ca9d30b34846f54b1fd9b8fd.tar.bz2 |
cc : Make tree synchronization independent of layer tree hierarchy (2)
This CL :
* Stores layers that need to push properties in LayerTreeHost(layer_set)
* Deletes bools needs_push_properties and dependants_needs_push_properties
from Layer.
* Iterate the layer_set tp push properties during commit.
* Changes what layers are serialized (Both dirty layers and their ancestors
are serialized currently. With this CL, only dirty layers serialize).
BUG=568874
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1808373002
Cr-Commit-Position: refs/heads/master@{#382379}
Diffstat (limited to 'cc/trees')
-rw-r--r-- | cc/trees/layer_tree_host.cc | 33 | ||||
-rw-r--r-- | cc/trees/layer_tree_host.h | 10 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 8 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 403 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_scroll.cc | 8 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_serialization.cc | 7 | ||||
-rw-r--r-- | cc/trees/tree_synchronizer.cc | 82 | ||||
-rw-r--r-- | cc/trees/tree_synchronizer.h | 16 | ||||
-rw-r--r-- | cc/trees/tree_synchronizer_unittest.cc | 50 |
9 files changed, 315 insertions, 302 deletions
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index e669e27..a39d8b6 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc @@ -466,7 +466,8 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { { TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); - TreeSynchronizer::PushProperties(root_layer(), sync_tree->root_layer()); + + TreeSynchronizer::PushLayerProperties(this, sync_tree); TRACE_EVENT0("cc", "LayerTreeHost::AnimationHost::PushProperties"); DCHECK(host_impl->animation_host()); @@ -1222,6 +1223,23 @@ Layer* LayerTreeHost::LayerById(int id) const { return iter != layer_id_map_.end() ? iter->second : NULL; } +void LayerTreeHost::AddLayerShouldPushProperties(Layer* layer) { + layers_that_should_push_properties_.insert(layer); +} + +void LayerTreeHost::RemoveLayerShouldPushProperties(Layer* layer) { + layers_that_should_push_properties_.erase(layer); +} + +std::unordered_set<Layer*>& LayerTreeHost::LayersThatShouldPushProperties() { + return layers_that_should_push_properties_; +} + +bool LayerTreeHost::LayerNeedsPushPropertiesForTesting(Layer* layer) { + return layers_that_should_push_properties_.find(layer) != + layers_that_should_push_properties_.end(); +} + void LayerTreeHost::RegisterLayer(Layer* layer) { DCHECK(!LayerById(layer->id())); DCHECK(!in_paint_layer_contents_); @@ -1233,6 +1251,7 @@ void LayerTreeHost::UnregisterLayer(Layer* layer) { DCHECK(LayerById(layer->id())); DCHECK(!in_paint_layer_contents_); animation_host_->UnregisterLayer(layer->id(), LayerTreeType::ACTIVE); + RemoveLayerShouldPushProperties(layer); layer_id_map_.erase(layer->id()); } @@ -1394,8 +1413,8 @@ bool LayerTreeHost::IsRemoteClient() const { task_runner_provider_->HasImplThread(); } -void LayerTreeHost::ToProtobufForCommit(proto::LayerTreeHost* proto) const { - // Not all fields are serialized, as they are eiher not needed for a commit, +void LayerTreeHost::ToProtobufForCommit(proto::LayerTreeHost* proto) { + // Not all fields are serialized, as they are either not needed for a commit, // or implementation isn't ready yet. // Unsupported items: // - animations @@ -1422,7 +1441,11 @@ void LayerTreeHost::ToProtobufForCommit(proto::LayerTreeHost* proto) const { meta_information_sequence_number_); LayerProtoConverter::SerializeLayerHierarchy(root_layer_, proto->mutable_root_layer()); - LayerProtoConverter::SerializeLayerProperties(root_layer_.get(), + // layers_that_should_push_properties_ should be serialized before layer + // properties because it is cleared during the properties serialization. + for (auto layer : layers_that_should_push_properties_) + proto->add_layers_that_should_push_properties(layer->id()); + LayerProtoConverter::SerializeLayerProperties(this, proto->mutable_layer_updates()); proto->set_hud_layer_id(hud_layer_ ? hud_layer_->id() : Layer::INVALID_ID); debug_state_.ToProtobuf(proto->mutable_debug_state()); @@ -1491,6 +1514,8 @@ void LayerTreeHost::FromProtobufForCommit(const proto::LayerTreeHost& proto) { LayerTreeHostCommon::CallFunctionForSubtree( root_layer(), [this](Layer* layer) { layer_id_map_[layer->id()] = layer; }); + for (auto layer_id : proto.layers_that_should_push_properties()) + layers_that_should_push_properties_.insert(layer_id_map_[layer_id]); LayerProtoConverter::DeserializeLayerProperties(root_layer_.get(), proto.layer_updates()); diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h index f80cdb4..c82e9f6 100644 --- a/cc/trees/layer_tree_host.h +++ b/cc/trees/layer_tree_host.h @@ -357,6 +357,12 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient { scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); Layer* LayerById(int id) const; + + void AddLayerShouldPushProperties(Layer* layer); + void RemoveLayerShouldPushProperties(Layer* layer); + std::unordered_set<Layer*>& LayersThatShouldPushProperties(); + bool LayerNeedsPushPropertiesForTesting(Layer* layer); + void RegisterLayer(Layer* layer); void UnregisterLayer(Layer* layer); // LayerTreeMutatorsClient implementation. @@ -401,7 +407,7 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient { // Serializes the parts of this LayerTreeHost that is needed for a commit to a // protobuf message. Not all members are serialized as they are not helpful // for remote usage. - void ToProtobufForCommit(proto::LayerTreeHost* proto) const; + void ToProtobufForCommit(proto::LayerTreeHost* proto); // Deserializes the protobuf into this LayerTreeHost before a commit. The // expected input is a serialized remote LayerTreeHost. After deserializing @@ -580,6 +586,8 @@ class CC_EXPORT LayerTreeHost : public MutatorHostClient { using LayerIdMap = std::unordered_map<int, Layer*>; LayerIdMap layer_id_map_; + // Set of layers that need to push properties. + std::unordered_set<Layer*> layers_that_should_push_properties_; uint32_t surface_id_namespace_; uint32_t next_surface_sequence_; diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index b22de54..bf706b6 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -1974,13 +1974,7 @@ void LayerTreeHostImpl::ActivateSyncTree() { active_tree_->root_layer()->PushLayerPropertyChangedForSubtree(); } - std::unordered_set<LayerImpl*> layers_that_should_push_properties = - pending_tree_->LayersThatShouldPushProperties(); - for (auto pending_layer : layers_that_should_push_properties) { - LayerImpl* active_layer = active_tree_->LayerById(pending_layer->id()); - DCHECK(active_layer); - pending_layer->PushPropertiesTo(active_layer); - } + TreeSynchronizer::PushLayerProperties(pending_tree(), active_tree()); pending_tree_->PushPropertiesTo(active_tree_.get()); if (pending_tree_->root_layer()) pending_tree_->property_trees()->ResetAllChangeTracking( diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 25548da..673d586 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -2737,8 +2737,9 @@ class PushPropertiesCountingLayer : public Layer { void PushPropertiesTo(LayerImpl* layer) override { Layer::PushPropertiesTo(layer); push_properties_count_++; - if (persist_needs_push_properties_) - needs_push_properties_ = true; + if (persist_needs_push_properties_) { + layer_tree_host()->AddLayerShouldPushProperties(this); + } } // Something to make this layer push properties, but no other layer. @@ -2823,32 +2824,36 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { // The scrollbar layer always needs to be pushed. if (root_->layer_tree_host()) { - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(root_->needs_push_properties()); + EXPECT_FALSE(root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( + root_.get())); } if (child2_->layer_tree_host()) { - EXPECT_TRUE(child2_->descendant_needs_push_properties()); - EXPECT_FALSE(child2_->needs_push_properties()); + EXPECT_FALSE( + child2_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child2_.get())); } if (leaf_always_pushing_layer_->layer_tree_host()) { - EXPECT_FALSE( - leaf_always_pushing_layer_->descendant_needs_push_properties()); - EXPECT_TRUE(leaf_always_pushing_layer_->needs_push_properties()); + EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host() + ->LayerNeedsPushPropertiesForTesting( + leaf_always_pushing_layer_.get())); } // child_ and grandchild_ don't persist their need to push properties. if (child_->layer_tree_host()) { - EXPECT_FALSE(child_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); + EXPECT_FALSE( + child_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); } if (grandchild_->layer_tree_host()) { - EXPECT_FALSE(grandchild_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild_->needs_push_properties()); + EXPECT_FALSE( + grandchild_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild_.get())); } if (other_root_->layer_tree_host()) { - EXPECT_FALSE(other_root_->descendant_needs_push_properties()); - EXPECT_FALSE(other_root_->needs_push_properties()); + EXPECT_FALSE( + other_root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( + other_root_.get())); } switch (num_commits_) { @@ -3203,8 +3208,8 @@ class LayerTreeHostTestPropertyChangesDuringUpdateArePushed scrollbar_layer_->SetBounds(gfx::Size(30, 30)); - EXPECT_TRUE(scrollbar_layer_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + scrollbar_layer_.get())); layer_tree_host()->SetNeedsCommit(); scrollbar_layer_->reset_push_properties_count(); @@ -3248,8 +3253,10 @@ class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { // avoid causing a second commit to be scheduled. If a property change // is made during this, however, it needs to be pushed in the upcoming // commit. - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); root_->reset_push_properties_count(); child_->reset_push_properties_count(); @@ -3257,15 +3264,19 @@ class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); EXPECT_EQ(0u, root_->push_properties_count()); EXPECT_EQ(0u, child_->push_properties_count()); - EXPECT_TRUE(root_->needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); + EXPECT_TRUE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); break; } case 2: EXPECT_EQ(1u, root_->push_properties_count()); EXPECT_EQ(1u, child_->push_properties_count()); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); EndTest(); break; } @@ -3330,24 +3341,18 @@ class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; switch (last_source_frame_number) { case 0: - // All layers except root will need push properties as they are added - // as a child to some other layer which changes their stacking order. - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); - + // All layers will need push properties as we set their layer tree host layer_tree_host()->SetRootLayer(root_); - - // Now, even the root will need to push properties. - EXPECT_TRUE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); + EXPECT_TRUE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); break; case 1: EndTest(); @@ -3368,71 +3373,71 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion layer_tree_host()->SetRootLayer(root_); break; case 1: - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); grandchild1_->RemoveFromParent(); grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); child_->AddChild(grandchild1_); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); // grandchild2_ will still need a push properties. grandchild1_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); // grandchild3_ does not need a push properties, so recursing should // no longer be needed. grandchild2_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); EndTest(); break; } @@ -3453,33 +3458,33 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence grandchild2_->set_persist_needs_push_properties(true); break; case 1: - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); // grandchild2_ will still need a push properties. grandchild1_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); // grandchild3_ does not need a push properties, so recursing should // no longer be needed. grandchild2_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); EndTest(); break; } @@ -3499,16 +3504,16 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree layer_tree_host()->SetRootLayer(root_); break; case 1: - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); // Change grandchildren while their parent is not in the tree. child_->RemoveFromParent(); @@ -3516,37 +3521,37 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); root_->AddChild(child_); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); grandchild1_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); grandchild2_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); grandchild3_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); EndTest(); break; @@ -3567,50 +3572,50 @@ class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild layer_tree_host()->SetRootLayer(root_); break; case 1: - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); child_->SetPosition(gfx::PointF(1.f, 1.f)); grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); grandchild1_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); grandchild2_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); child_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); EndTest(); break; @@ -3631,50 +3636,50 @@ class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent layer_tree_host()->SetRootLayer(root_); break; case 1: - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); - EXPECT_FALSE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); child_->SetPosition(gfx::PointF(1.f, 1.f)); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild1_->needs_push_properties()); - EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); - EXPECT_TRUE(grandchild2_->needs_push_properties()); - EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); - EXPECT_FALSE(grandchild3_->needs_push_properties()); - EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild1_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild2_.get())); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + grandchild3_.get())); grandchild1_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_TRUE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); grandchild2_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_TRUE(root_->descendant_needs_push_properties()); - EXPECT_TRUE(child_->needs_push_properties()); - EXPECT_FALSE(child_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); + EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_.get())); child_->RemoveFromParent(); - EXPECT_FALSE(root_->needs_push_properties()); - EXPECT_FALSE(root_->descendant_needs_push_properties()); + EXPECT_FALSE( + layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); EndTest(); break; @@ -3858,7 +3863,8 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { switch (layer_tree_host()->source_frame_number()) { case 1: // The layer type used does not need to push properties every frame. - EXPECT_FALSE(child_layer_->needs_push_properties()); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_layer_.get())); // Change the bounds of the child layer, but make it skipped // by CalculateDrawProperties. @@ -3867,7 +3873,8 @@ class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { break; case 2: // The bounds of the child layer were pushed to the impl side. - EXPECT_FALSE(child_layer_->needs_push_properties()); + EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( + child_layer_.get())); EndTest(); break; diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index 024e65b..b056a76 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc @@ -949,13 +949,17 @@ class LayerTreeHostScrollTestImplOnlyScroll : public LayerTreeHostScrollTest { Layer* scroll_layer = layer_tree_host()->outer_viewport_scroll_layer(); switch (layer_tree_host()->source_frame_number()) { case 0: - EXPECT_TRUE(scroll_layer->needs_push_properties()); + EXPECT_TRUE( + scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( + scroll_layer)); break; case 1: // Even if this layer doesn't need push properties, it should // still pick up scrolls that happen on the active layer during // commit. - EXPECT_FALSE(scroll_layer->needs_push_properties()); + EXPECT_FALSE( + scroll_layer->layer_tree_host()->LayerNeedsPushPropertiesForTesting( + scroll_layer)); break; } } diff --git a/cc/trees/layer_tree_host_unittest_serialization.cc b/cc/trees/layer_tree_host_unittest_serialization.cc index db166ed..3e3e0a1 100644 --- a/cc/trees/layer_tree_host_unittest_serialization.cc +++ b/cc/trees/layer_tree_host_unittest_serialization.cc @@ -49,6 +49,9 @@ class LayerTreeHostSerializationTest : public testing::Test { void VerifySerializationAndDeserialization() { proto::LayerTreeHost proto; + + std::unordered_set<Layer*> layers_that_should_push_properties_src = + layer_tree_host_src_->LayersThatShouldPushProperties(); layer_tree_host_src_->ToProtobufForCommit(&proto); layer_tree_host_dst_->FromProtobufForCommit(proto); @@ -102,6 +105,10 @@ class LayerTreeHostSerializationTest : public testing::Test { EXPECT_EQ(layer_tree_host_src_->id_, layer_tree_host_dst_->id_); EXPECT_EQ(layer_tree_host_src_->next_commit_forces_redraw_, layer_tree_host_dst_->next_commit_forces_redraw_); + for (auto layer : layers_that_should_push_properties_src) { + EXPECT_TRUE(layer_tree_host_dst_->LayerNeedsPushPropertiesForTesting( + layer_tree_host_dst_->LayerById(layer->id()))); + } if (layer_tree_host_src_->hud_layer_) { EXPECT_EQ(layer_tree_host_src_->hud_layer_->id(), diff --git a/cc/trees/tree_synchronizer.cc b/cc/trees/tree_synchronizer.cc index af87056..a134bb4 100644 --- a/cc/trees/tree_synchronizer.cc +++ b/cc/trees/tree_synchronizer.cc @@ -13,6 +13,8 @@ #include "base/trace_event/trace_event.h" #include "cc/layers/layer.h" #include "cc/layers/layer_impl.h" +#include "cc/trees/layer_tree_host.h" +#include "cc/trees/layer_tree_impl.h" namespace cc { @@ -129,55 +131,6 @@ scoped_ptr<LayerImpl> SynchronizeTreesRecursive( new_layers, old_layers, layer, tree_impl); } -void TreeSynchronizer::PushPropertiesInternal( - Layer* layer, - LayerImpl* layer_impl, - int* num_dependents_need_push_properties_for_parent) { - if (!layer) { - DCHECK(!layer_impl); - return; - } - - DCHECK_EQ(layer->id(), layer_impl->id()); - - bool push_layer = layer->needs_push_properties(); - bool recurse_on_children_and_dependents = - layer->descendant_needs_push_properties(); - - if (push_layer) - layer->PushPropertiesTo(layer_impl); - - int num_dependents_need_push_properties = 0; - if (recurse_on_children_and_dependents) { - PushPropertiesInternal(layer->mask_layer(), - layer_impl->mask_layer(), - &num_dependents_need_push_properties); - PushPropertiesInternal(layer->replica_layer(), - layer_impl->replica_layer(), - &num_dependents_need_push_properties); - - const OwnedLayerImplList& impl_children = layer_impl->children(); - DCHECK_EQ(layer->children().size(), impl_children.size()); - - for (size_t i = 0; i < layer->children().size(); ++i) { - PushPropertiesInternal(layer->child_at(i), impl_children[i].get(), - &num_dependents_need_push_properties); - } - - // When PushPropertiesTo completes for a layer, it may still keep - // its needs_push_properties() state if the layer must push itself - // every PushProperties tree walk. Here we keep track of those layers, and - // ensure that their ancestors know about them for the next PushProperties - // tree walk. - layer->num_dependents_need_push_properties_ = - num_dependents_need_push_properties; - } - - bool add_self_to_parent = num_dependents_need_push_properties > 0 || - layer->needs_push_properties(); - *num_dependents_need_push_properties_for_parent += add_self_to_parent ? 1 : 0; -} - static void CheckScrollAndClipPointersRecursive(Layer* layer, LayerImpl* layer_impl) { DCHECK_EQ(!!layer, !!layer_impl); @@ -234,13 +187,32 @@ static void CheckScrollAndClipPointersRecursive(Layer* layer, } } -void TreeSynchronizer::PushProperties(Layer* layer, - LayerImpl* layer_impl) { - int num_dependents_need_push_properties = 0; - PushPropertiesInternal( - layer, layer_impl, &num_dependents_need_push_properties); +template <typename LayerType> +static void PushLayerPropertiesInternal( + std::unordered_set<LayerType*> layers_that_should_push_properties, + LayerTreeImpl* impl_tree) { + for (auto layer : layers_that_should_push_properties) { + LayerImpl* layer_impl = impl_tree->LayerById(layer->id()); + DCHECK(layer_impl); + layer->PushPropertiesTo(layer_impl); + } +} + +void TreeSynchronizer::PushLayerProperties(LayerTreeImpl* pending_tree, + LayerTreeImpl* active_tree) { + PushLayerPropertiesInternal(pending_tree->LayersThatShouldPushProperties(), + active_tree); +} + +void TreeSynchronizer::PushLayerProperties(LayerTreeHost* host_tree, + LayerTreeImpl* impl_tree) { + PushLayerPropertiesInternal(host_tree->LayersThatShouldPushProperties(), + impl_tree); + #if DCHECK_IS_ON() - CheckScrollAndClipPointersRecursive(layer, layer_impl); + if (host_tree->root_layer() && impl_tree->root_layer()) + CheckScrollAndClipPointersRecursive(host_tree->root_layer(), + impl_tree->root_layer()); #endif } diff --git a/cc/trees/tree_synchronizer.h b/cc/trees/tree_synchronizer.h index 2e6e8f0..3c87374 100644 --- a/cc/trees/tree_synchronizer.h +++ b/cc/trees/tree_synchronizer.h @@ -12,6 +12,7 @@ namespace cc { class LayerImpl; +class LayerTreeHost; class LayerTreeImpl; class Layer; @@ -28,21 +29,14 @@ class CC_EXPORT TreeSynchronizer { LayerImpl* layer_root, scoped_ptr<LayerImpl> old_layer_impl_root, LayerTreeImpl* tree_impl); - - // Pushes properties from a Layer or LayerImpl tree to a structurally - // equivalent LayerImpl tree. - static void PushProperties(Layer* layer_root, - LayerImpl* layer_impl_root); - static void PushProperties(LayerImpl* layer_root, LayerImpl* layer_impl_root); + static void PushLayerProperties(LayerTreeImpl* pending_tree, + LayerTreeImpl* active_tree); + static void PushLayerProperties(LayerTreeHost* host_tree, + LayerTreeImpl* impl_tree); private: TreeSynchronizer(); // Not instantiable. - static void PushPropertiesInternal( - Layer* layer, - LayerImpl* layer_impl, - int* num_dependents_need_push_properties_for_parent); - DISALLOW_COPY_AND_ASSIGN(TreeSynchronizer); }; diff --git a/cc/trees/tree_synchronizer_unittest.cc b/cc/trees/tree_synchronizer_unittest.cc index ee4041a..4e30719 100644 --- a/cc/trees/tree_synchronizer_unittest.cc +++ b/cc/trees/tree_synchronizer_unittest.cc @@ -243,8 +243,8 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeReusingLayers) { host_->active_tree()); // We have to push properties to pick up the destruction list pointer. - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_->active_tree()); // Add a new layer to the Layer side layer_tree_root->children()[0]->AddChild( @@ -288,7 +288,8 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndTrackStackingOrderChange) { host_->active_tree()); // We have to push properties to pick up the destruction list pointer. - TreeSynchronizer::PushProperties(layer_tree_root.get(), layer_impl_tree_root); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_->active_tree()); host_->active_tree()->ResetAllChangeTracking( PropertyTrees::ResetFlags::ALL_TREES); @@ -303,7 +304,8 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndTrackStackingOrderChange) { ExpectTreesAreIdentical(layer_tree_root.get(), layer_impl_tree_root, host_->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), layer_impl_tree_root); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_->active_tree()); // Check that the impl thread properly tracked the change. EXPECT_FALSE(layer_impl_tree_root->LayerPropertyChanged()); @@ -338,8 +340,8 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeAndProperties) { layer_impl_tree_root.get(), host_->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_->active_tree()); // Check that the property values we set on the Layer tree are reflected in // the LayerImpl tree. @@ -389,8 +391,8 @@ TEST_F(TreeSynchronizerTest, ReuseLayerImplsAfterStructuralChange) { host_->active_tree()); // We have to push properties to pick up the destruction list pointer. - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_->active_tree()); // Now restructure the tree to look like this: // root --- D ---+--- A @@ -444,8 +446,8 @@ TEST_F(TreeSynchronizerTest, SyncSimpleTreeThenDestroy) { host_->active_tree()); // We have to push properties to pick up the destruction list pointer. - TreeSynchronizer::PushProperties(old_layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(old_layer_tree_root->layer_tree_host(), + host_->active_tree()); // Remove all children on the Layer side. old_layer_tree_root->RemoveAllChildren(); @@ -562,8 +564,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { scoped_ptr<LayerImpl> layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( layer_tree_root.get(), nullptr, host_impl->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_impl->active_tree()); { SCOPED_TRACE("case one"); ExpectTreesAreIdentical(layer_tree_root.get(), @@ -576,8 +578,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( layer_tree_root.get(), std::move(layer_impl_tree_root), host_impl->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_impl->active_tree()); { SCOPED_TRACE("case two"); ExpectTreesAreIdentical(layer_tree_root.get(), @@ -592,8 +594,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeScrollParent) { layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( layer_tree_root.get(), std::move(layer_impl_tree_root), host_impl->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_impl->active_tree()); { SCOPED_TRACE("case three"); ExpectTreesAreIdentical(layer_tree_root.get(), @@ -631,8 +633,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { scoped_ptr<LayerImpl> layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( layer_tree_root.get(), nullptr, host_impl->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_impl->active_tree()); ExpectTreesAreIdentical(layer_tree_root.get(), layer_impl_tree_root.get(), host_impl->active_tree()); @@ -644,8 +646,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( layer_tree_root.get(), std::move(layer_impl_tree_root), host_impl->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_impl->active_tree()); ExpectTreesAreIdentical(layer_tree_root.get(), layer_impl_tree_root.get(), host_impl->active_tree()); @@ -657,8 +659,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( layer_tree_root.get(), std::move(layer_impl_tree_root), host_impl->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_impl->active_tree()); ExpectTreesAreIdentical(layer_tree_root.get(), layer_impl_tree_root.get(), host_impl->active_tree()); @@ -669,8 +671,8 @@ TEST_F(TreeSynchronizerTest, SynchronizeClipParent) { layer_impl_tree_root = TreeSynchronizer::SynchronizeTrees( layer_tree_root.get(), std::move(layer_impl_tree_root), host_impl->active_tree()); - TreeSynchronizer::PushProperties(layer_tree_root.get(), - layer_impl_tree_root.get()); + TreeSynchronizer::PushLayerProperties(layer_tree_root->layer_tree_host(), + host_impl->active_tree()); ExpectTreesAreIdentical(layer_tree_root.get(), layer_impl_tree_root.get(), host_impl->active_tree()); |