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

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

Issue 1801853002: Transfer LayerImpl ownership to LayerTreeImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more asan. Created 4 years, 9 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 "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 "cc/layers/heads_up_display_layer.h" 10 #include "cc/layers/heads_up_display_layer.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 void InvalidateAndSetNeedsCommit() override { 640 void InvalidateAndSetNeedsCommit() override {
641 // Invalidate the render surface so we don't try to use a cached copy of the 641 // Invalidate the render surface so we don't try to use a cached copy of the
642 // surface. We want to make sure to test the drawing paths for drawing to 642 // surface. We want to make sure to test the drawing paths for drawing to
643 // a child surface. 643 // a child surface.
644 layer_->SetNeedsDisplay(); 644 layer_->SetNeedsDisplay();
645 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); 645 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit();
646 } 646 }
647 647
648 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 648 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
649 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>( 649 FakePictureLayerImpl* picture_impl = static_cast<FakePictureLayerImpl*>(
650 host_impl->active_tree()->root_layer()->children()[0].get()); 650 host_impl->active_tree()->root_layer()->children()[0]);
651 EXPECT_TRUE(picture_impl->HighResTiling() 651 EXPECT_TRUE(picture_impl->HighResTiling()
652 ->TileAt(0, 0) 652 ->TileAt(0, 0)
653 ->draw_info() 653 ->draw_info()
654 .IsReadyToDraw()); 654 .IsReadyToDraw());
655 } 655 }
656 656
657 protected: 657 protected:
658 FakeContentLayerClient client_; 658 FakeContentLayerClient client_;
659 scoped_refptr<Layer> root_; 659 scoped_refptr<Layer> root_;
660 scoped_refptr<Layer> layer_; 660 scoped_refptr<Layer> layer_;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 851 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
852 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl); 852 LayerTreeHostContextTest::DidActivateTreeOnThread(host_impl);
853 853
854 FakePictureLayerImpl* root_picture = NULL; 854 FakePictureLayerImpl* root_picture = NULL;
855 FakePictureLayerImpl* child_picture = NULL; 855 FakePictureLayerImpl* child_picture = NULL;
856 FakePictureLayerImpl* grandchild_picture = NULL; 856 FakePictureLayerImpl* grandchild_picture = NULL;
857 857
858 root_picture = static_cast<FakePictureLayerImpl*>( 858 root_picture = static_cast<FakePictureLayerImpl*>(
859 host_impl->active_tree()->root_layer()); 859 host_impl->active_tree()->root_layer());
860 child_picture = 860 child_picture =
861 static_cast<FakePictureLayerImpl*>(root_picture->children()[0].get()); 861 static_cast<FakePictureLayerImpl*>(root_picture->children()[0]);
862 grandchild_picture = 862 grandchild_picture =
863 static_cast<FakePictureLayerImpl*>(child_picture->children()[0].get()); 863 static_cast<FakePictureLayerImpl*>(child_picture->children()[0]);
864 864
865 ++num_commits_; 865 ++num_commits_;
866 switch (num_commits_) { 866 switch (num_commits_) {
867 case 1: 867 case 1:
868 EXPECT_EQ(0u, root_picture->release_resources_count()); 868 EXPECT_EQ(0u, root_picture->release_resources_count());
869 EXPECT_EQ(0u, child_picture->release_resources_count()); 869 EXPECT_EQ(0u, child_picture->release_resources_count());
870 EXPECT_EQ(0u, grandchild_picture->release_resources_count()); 870 EXPECT_EQ(0u, grandchild_picture->release_resources_count());
871 871
872 // Lose the context and struggle to recreate it. 872 // Lose the context and struggle to recreate it.
873 LoseContext(); 873 LoseContext();
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 void AfterTest() override {} 1610 void AfterTest() override {}
1611 1611
1612 bool deferred_; 1612 bool deferred_;
1613 }; 1613 };
1614 1614
1615 SINGLE_AND_MULTI_THREAD_TEST_F( 1615 SINGLE_AND_MULTI_THREAD_TEST_F(
1616 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1616 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1617 1617
1618 } // namespace 1618 } // namespace
1619 } // namespace cc 1619 } // 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