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

Side by Side Diff: cc/trees/tree_synchronizer_unittest.cc

Issue 500123003: Remove implicit conversions from scoped_refptr to T* in cc/trees/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/tree_synchronizer.h" 5 #include "cc/trees/tree_synchronizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 scoped_refptr<Layer> layer_tree_root = Layer::Create(); 610 scoped_refptr<Layer> layer_tree_root = Layer::Create();
611 scoped_refptr<Layer> scroll_parent = Layer::Create(); 611 scoped_refptr<Layer> scroll_parent = Layer::Create();
612 layer_tree_root->AddChild(scroll_parent); 612 layer_tree_root->AddChild(scroll_parent);
613 layer_tree_root->AddChild(Layer::Create()); 613 layer_tree_root->AddChild(Layer::Create());
614 layer_tree_root->AddChild(Layer::Create()); 614 layer_tree_root->AddChild(Layer::Create());
615 615
616 host_->SetRootLayer(layer_tree_root); 616 host_->SetRootLayer(layer_tree_root);
617 617
618 // First child is the second and third child's scroll parent. 618 // First child is the second and third child's scroll parent.
619 layer_tree_root->children()[1]->SetScrollParent(scroll_parent); 619 layer_tree_root->children()[1]->SetScrollParent(scroll_parent.get());
620 layer_tree_root->children()[2]->SetScrollParent(scroll_parent); 620 layer_tree_root->children()[2]->SetScrollParent(scroll_parent.get());
621 621
622 scoped_ptr<LayerImpl> layer_impl_tree_root = 622 scoped_ptr<LayerImpl> layer_impl_tree_root =
623 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(), 623 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(),
624 scoped_ptr<LayerImpl>(), 624 scoped_ptr<LayerImpl>(),
625 host_impl->active_tree()); 625 host_impl->active_tree());
626 TreeSynchronizer::PushProperties(layer_tree_root.get(), 626 TreeSynchronizer::PushProperties(layer_tree_root.get(),
627 layer_impl_tree_root.get()); 627 layer_impl_tree_root.get());
628 { 628 {
629 SCOPED_TRACE("case one"); 629 SCOPED_TRACE("case one");
630 ExpectTreesAreIdentical(layer_tree_root.get(), 630 ExpectTreesAreIdentical(layer_tree_root.get(),
(...skipping 12 matching lines...) Expand all
643 { 643 {
644 SCOPED_TRACE("case two"); 644 SCOPED_TRACE("case two");
645 ExpectTreesAreIdentical(layer_tree_root.get(), 645 ExpectTreesAreIdentical(layer_tree_root.get(),
646 layer_impl_tree_root.get(), 646 layer_impl_tree_root.get(),
647 host_impl->active_tree()); 647 host_impl->active_tree());
648 } 648 }
649 649
650 // Add an additional scroll layer. 650 // Add an additional scroll layer.
651 scoped_refptr<Layer> additional_scroll_child = Layer::Create(); 651 scoped_refptr<Layer> additional_scroll_child = Layer::Create();
652 layer_tree_root->AddChild(additional_scroll_child); 652 layer_tree_root->AddChild(additional_scroll_child);
653 additional_scroll_child->SetScrollParent(scroll_parent); 653 additional_scroll_child->SetScrollParent(scroll_parent.get());
654 layer_impl_tree_root = 654 layer_impl_tree_root =
655 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(), 655 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(),
656 layer_impl_tree_root.Pass(), 656 layer_impl_tree_root.Pass(),
657 host_impl->active_tree()); 657 host_impl->active_tree());
658 TreeSynchronizer::PushProperties(layer_tree_root.get(), 658 TreeSynchronizer::PushProperties(layer_tree_root.get(),
659 layer_impl_tree_root.get()); 659 layer_impl_tree_root.get());
660 { 660 {
661 SCOPED_TRACE("case three"); 661 SCOPED_TRACE("case three");
662 ExpectTreesAreIdentical(layer_tree_root.get(), 662 ExpectTreesAreIdentical(layer_tree_root.get(),
663 layer_impl_tree_root.get(), 663 layer_impl_tree_root.get(),
(...skipping 22 matching lines...) Expand all
686 scoped_refptr<Layer> clip_child1 = Layer::Create(); 686 scoped_refptr<Layer> clip_child1 = Layer::Create();
687 scoped_refptr<Layer> clip_child2 = Layer::Create(); 687 scoped_refptr<Layer> clip_child2 = Layer::Create();
688 layer_tree_root->AddChild(clip_parent); 688 layer_tree_root->AddChild(clip_parent);
689 clip_parent->AddChild(intervening); 689 clip_parent->AddChild(intervening);
690 intervening->AddChild(clip_child1); 690 intervening->AddChild(clip_child1);
691 intervening->AddChild(clip_child2); 691 intervening->AddChild(clip_child2);
692 692
693 host_->SetRootLayer(layer_tree_root); 693 host_->SetRootLayer(layer_tree_root);
694 694
695 // First child is the second and third child's scroll parent. 695 // First child is the second and third child's scroll parent.
696 clip_child1->SetClipParent(clip_parent); 696 clip_child1->SetClipParent(clip_parent.get());
697 clip_child2->SetClipParent(clip_parent); 697 clip_child2->SetClipParent(clip_parent.get());
698 698
699 scoped_ptr<LayerImpl> layer_impl_tree_root = 699 scoped_ptr<LayerImpl> layer_impl_tree_root =
700 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(), 700 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(),
701 scoped_ptr<LayerImpl>(), 701 scoped_ptr<LayerImpl>(),
702 host_impl->active_tree()); 702 host_impl->active_tree());
703 TreeSynchronizer::PushProperties(layer_tree_root.get(), 703 TreeSynchronizer::PushProperties(layer_tree_root.get(),
704 layer_impl_tree_root.get()); 704 layer_impl_tree_root.get());
705 ExpectTreesAreIdentical(layer_tree_root.get(), 705 ExpectTreesAreIdentical(layer_tree_root.get(),
706 layer_impl_tree_root.get(), 706 layer_impl_tree_root.get(),
707 host_impl->active_tree()); 707 host_impl->active_tree());
708 708
709 // Remove the first clip child. 709 // Remove the first clip child.
710 clip_child1->RemoveFromParent(); 710 clip_child1->RemoveFromParent();
711 clip_child1 = NULL; 711 clip_child1 = NULL;
712 712
713 layer_impl_tree_root = 713 layer_impl_tree_root =
714 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(), 714 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(),
715 layer_impl_tree_root.Pass(), 715 layer_impl_tree_root.Pass(),
716 host_impl->active_tree()); 716 host_impl->active_tree());
717 TreeSynchronizer::PushProperties(layer_tree_root.get(), 717 TreeSynchronizer::PushProperties(layer_tree_root.get(),
718 layer_impl_tree_root.get()); 718 layer_impl_tree_root.get());
719 ExpectTreesAreIdentical(layer_tree_root.get(), 719 ExpectTreesAreIdentical(layer_tree_root.get(),
720 layer_impl_tree_root.get(), 720 layer_impl_tree_root.get(),
721 host_impl->active_tree()); 721 host_impl->active_tree());
722 722
723 // Add an additional clip child. 723 // Add an additional clip child.
724 scoped_refptr<Layer> additional_clip_child = Layer::Create(); 724 scoped_refptr<Layer> additional_clip_child = Layer::Create();
725 intervening->AddChild(additional_clip_child); 725 intervening->AddChild(additional_clip_child);
726 additional_clip_child->SetClipParent(clip_parent); 726 additional_clip_child->SetClipParent(clip_parent.get());
727 layer_impl_tree_root = 727 layer_impl_tree_root =
728 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(), 728 TreeSynchronizer::SynchronizeTrees(layer_tree_root.get(),
729 layer_impl_tree_root.Pass(), 729 layer_impl_tree_root.Pass(),
730 host_impl->active_tree()); 730 host_impl->active_tree());
731 TreeSynchronizer::PushProperties(layer_tree_root.get(), 731 TreeSynchronizer::PushProperties(layer_tree_root.get(),
732 layer_impl_tree_root.get()); 732 layer_impl_tree_root.get());
733 ExpectTreesAreIdentical(layer_tree_root.get(), 733 ExpectTreesAreIdentical(layer_tree_root.get(),
734 layer_impl_tree_root.get(), 734 layer_impl_tree_root.get(),
735 host_impl->active_tree()); 735 host_impl->active_tree());
736 736
(...skipping 11 matching lines...) Expand all
748 host_impl->active_tree()); 748 host_impl->active_tree());
749 749
750 // The clip children should have been unhooked. 750 // The clip children should have been unhooked.
751 EXPECT_EQ(2u, intervening->children().size()); 751 EXPECT_EQ(2u, intervening->children().size());
752 EXPECT_FALSE(clip_child2->clip_parent()); 752 EXPECT_FALSE(clip_child2->clip_parent());
753 EXPECT_FALSE(additional_clip_child->clip_parent()); 753 EXPECT_FALSE(additional_clip_child->clip_parent());
754 } 754 }
755 755
756 } // namespace 756 } // namespace
757 } // namespace cc 757 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698