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

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

Issue 1905713002: cc: Remove LayerImpl::children() calls from descendants of LayerTreeTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve comments 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "cc/layers/heads_up_display_layer.h" 9 #include "cc/layers/heads_up_display_layer.h"
10 #include "cc/layers/layer_impl.h" 10 #include "cc/layers/layer_impl.h"
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 void InvalidateAndSetNeedsCommit() override { 639 void InvalidateAndSetNeedsCommit() override {
640 // Invalidate the render surface so we don't try to use a cached copy of the 640 // Invalidate the render surface so we don't try to use a cached copy of the
641 // surface. We want to make sure to test the drawing paths for drawing to 641 // surface. We want to make sure to test the drawing paths for drawing to
642 // a child surface. 642 // a child surface.
643 layer_->SetNeedsDisplay(); 643 layer_->SetNeedsDisplay();
644 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); 644 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit();
645 } 645 }
646 646
647 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 647 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
648 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>( 648 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>(
649 host_impl->active_tree()->root_layer()->children()[0]); 649 host_impl->active_tree()->LayerById(layer_->id()));
650 EXPECT_TRUE(picture_impl->HighResTiling() 650 EXPECT_TRUE(picture_impl->HighResTiling()
651 ->TileAt(0, 0) 651 ->TileAt(0, 0)
652 ->draw_info() 652 ->draw_info()
653 .IsReadyToDraw()); 653 .IsReadyToDraw());
654 } 654 }
655 655
656 protected: 656 protected:
657 FakeContentLayerClient client_; 657 FakeContentLayerClient client_;
658 scoped_refptr<Layer> root_; 658 scoped_refptr<Layer> root_;
659 scoped_refptr<Layer> layer_; 659 scoped_refptr<Layer> layer_;
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 849
850 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 850 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
851 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl); 851 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl);
852 852
853 FakePictureLayerImpl* root_picture = NULL; 853 FakePictureLayerImpl* root_picture = NULL;
854 FakePictureLayerImpl* child_picture = NULL; 854 FakePictureLayerImpl* child_picture = NULL;
855 FakePictureLayerImpl* grandchild_picture = NULL; 855 FakePictureLayerImpl* grandchild_picture = NULL;
856 856
857 root_picture = static_cast<FakePictureLayerImpl*>( 857 root_picture = static_cast<FakePictureLayerImpl*>(
858 host_impl->active_tree()->root_layer()); 858 host_impl->active_tree()->root_layer());
859 child_picture = 859 child_picture = static_cast<FakePictureLayerImpl*>(
860 static_cast<FakePictureLayerImpl*>(root_picture->children()[0]); 860 host_impl->active_tree()->LayerById(child_->id()));
861 grandchild_picture = 861 grandchild_picture = static_cast<FakePictureLayerImpl*>(
862 static_cast<FakePictureLayerImpl*>(child_picture->children()[0]); 862 host_impl->active_tree()->LayerById(grandchild_->id()));
863 863
864 ++num_commits_; 864 ++num_commits_;
865 switch (num_commits_) { 865 switch (num_commits_) {
866 case 1: 866 case 1:
867 EXPECT_EQ(0u, root_picture->release_resources_count()); 867 EXPECT_EQ(0u, root_picture->release_resources_count());
868 EXPECT_EQ(0u, child_picture->release_resources_count()); 868 EXPECT_EQ(0u, child_picture->release_resources_count());
869 EXPECT_EQ(0u, grandchild_picture->release_resources_count()); 869 EXPECT_EQ(0u, grandchild_picture->release_resources_count());
870 870
871 // Lose the context and struggle to recreate it. 871 // Lose the context and struggle to recreate it.
872 LoseContext(); 872 LoseContext();
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 void AfterTest() override {} 1603 void AfterTest() override {}
1604 1604
1605 bool deferred_; 1605 bool deferred_;
1606 }; 1606 };
1607 1607
1608 SINGLE_AND_MULTI_THREAD_TEST_F( 1608 SINGLE_AND_MULTI_THREAD_TEST_F(
1609 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1609 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1610 1610
1611 } // namespace 1611 } // namespace
1612 } // namespace cc 1612 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_animation.cc ('k') | cc/trees/layer_tree_host_unittest_copyrequest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698