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

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

Issue 1855013002: cc : Stop calculating visible rects on main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_host_common.cc ('k') | cc/trees/property_tree_builder.h » ('j') | 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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 break; 773 break;
774 } 774 }
775 } 775 }
776 776
777 void AfterTest() override {} 777 void AfterTest() override {}
778 int index_; 778 int index_;
779 }; 779 };
780 780
781 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync); 781 SINGLE_THREAD_TEST_F(LayerTreeHostTestPropertyTreesChangedSync);
782 782
783 // Test that when mask layers switches layers, this gets pushed onto impl.
784 // Also test that mask layer is in the layer update list even if its owning
785 // layer isn't.
783 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest { 786 class LayerTreeHostTestSwitchMaskLayer : public LayerTreeHostTest {
784 protected: 787 protected:
785 void SetupTree() override { 788 void SetupTree() override {
786 scoped_refptr<Layer> root = Layer::Create(); 789 scoped_refptr<Layer> root = Layer::Create();
790 root->SetBounds(gfx::Size(10, 10));
787 scoped_refptr<Layer> child = Layer::Create(); 791 scoped_refptr<Layer> child = Layer::Create();
788 mask_layer = Layer::Create(); 792 mask_layer = Layer::Create();
793 mask_layer->SetBounds(gfx::Size(10, 10));
789 child->SetMaskLayer(mask_layer.get()); 794 child->SetMaskLayer(mask_layer.get());
790 root->AddChild(std::move(child)); 795 root->AddChild(std::move(child));
791 layer_tree_host()->SetRootLayer(root); 796 layer_tree_host()->SetRootLayer(root);
792 LayerTreeHostTest::SetupTree(); 797 LayerTreeHostTest::SetupTree();
793 } 798 }
794 799
795 void BeginTest() override { 800 void BeginTest() override {
796 index_ = 0; 801 index_ = 0;
797 PostSetNeedsCommitToMainThread(); 802 PostSetNeedsCommitToMainThread();
798 } 803 }
799 804
800 void DidCommit() override { 805 void DidCommit() override {
801 switch (layer_tree_host()->source_frame_number()) { 806 switch (layer_tree_host()->source_frame_number()) {
802 case 1: 807 case 1:
808 // Root and mask layer should have the same source frame number as they
809 // will be in the layer update list but the child is not as it has empty
810 // bounds.
811 EXPECT_EQ(mask_layer->paint_properties().source_frame_number,
812 layer_tree_host()
813 ->root_layer()
814 ->paint_properties()
815 .source_frame_number);
816 EXPECT_NE(mask_layer->paint_properties().source_frame_number,
817 layer_tree_host()
818 ->root_layer()
819 ->child_at(0)
820 ->paint_properties()
821 .source_frame_number);
803 layer_tree_host()->root_layer()->RemoveAllChildren(); 822 layer_tree_host()->root_layer()->RemoveAllChildren();
804 layer_tree_host()->root_layer()->SetMaskLayer(mask_layer.get()); 823 layer_tree_host()->root_layer()->SetMaskLayer(mask_layer.get());
805 break; 824 break;
806 } 825 }
807 } 826 }
808 827
809 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { 828 void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
810 switch (index_) { 829 switch (index_) {
811 case 0: 830 case 0:
812 index_++; 831 index_++;
(...skipping 5784 matching lines...) Expand 10 before | Expand all | Expand 10 after
6597 EndTest(); 6616 EndTest();
6598 } 6617 }
6599 6618
6600 void AfterTest() override {} 6619 void AfterTest() override {}
6601 }; 6620 };
6602 6621
6603 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6622 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6604 6623
6605 } // namespace 6624 } // namespace
6606 } // namespace cc 6625 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/property_tree_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698