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

Side by Side Diff: cc/test/layer_tree_test.cc

Issue 2251143002: cc: Reland Move data to LayerTree from LayerTreeHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: better fix? Created 4 years, 4 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 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/test/layer_tree_test.h" 5 #include "cc/test/layer_tree_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 inner_viewport_container_layer->id()); 64 inner_viewport_container_layer->id());
65 outer_scroll_layer->SetScrollClipLayerId( 65 outer_scroll_layer->SetScrollClipLayerId(
66 outer_viewport_container_layer->id()); 66 outer_viewport_container_layer->id());
67 67
68 inner_viewport_container_layer->SetBounds(inner_bounds); 68 inner_viewport_container_layer->SetBounds(inner_bounds);
69 inner_viewport_scroll_layer->SetBounds(outer_bounds); 69 inner_viewport_scroll_layer->SetBounds(outer_bounds);
70 outer_viewport_container_layer->SetBounds(outer_bounds); 70 outer_viewport_container_layer->SetBounds(outer_bounds);
71 71
72 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); 72 inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true);
73 outer_scroll_layer->SetIsContainerForFixedPositionLayers(true); 73 outer_scroll_layer->SetIsContainerForFixedPositionLayers(true);
74 host->RegisterViewportLayers(NULL, page_scale_layer, 74 host->GetLayerTree()->RegisterViewportLayers(
75 inner_viewport_scroll_layer, outer_scroll_layer); 75 NULL, page_scale_layer, inner_viewport_scroll_layer, outer_scroll_layer);
76 } 76 }
77 77
78 void CreateVirtualViewportLayers(Layer* root_layer, 78 void CreateVirtualViewportLayers(Layer* root_layer,
79 const gfx::Size& inner_bounds, 79 const gfx::Size& inner_bounds,
80 const gfx::Size& outer_bounds, 80 const gfx::Size& outer_bounds,
81 const gfx::Size& scroll_bounds, 81 const gfx::Size& scroll_bounds,
82 LayerTreeHost* host) { 82 LayerTreeHost* host) {
83 scoped_refptr<Layer> outer_viewport_scroll_layer = Layer::Create(); 83 scoped_refptr<Layer> outer_viewport_scroll_layer = Layer::Create();
84 84
85 outer_viewport_scroll_layer->SetBounds(scroll_bounds); 85 outer_viewport_scroll_layer->SetBounds(scroll_bounds);
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 674
675 // Allow commits to happen once BeginTest() has had a chance to post tasks 675 // Allow commits to happen once BeginTest() has had a chance to post tasks
676 // so that those tasks will happen before the first commit. 676 // so that those tasks will happen before the first commit.
677 if (layer_tree_host_) { 677 if (layer_tree_host_) {
678 static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get()) 678 static_cast<LayerTreeHostForTesting*>(layer_tree_host_.get())
679 ->set_test_started(true); 679 ->set_test_started(true);
680 } 680 }
681 } 681 }
682 682
683 void LayerTreeTest::SetupTree() { 683 void LayerTreeTest::SetupTree() {
684 if (!layer_tree_host_->root_layer()) { 684 if (!layer_tree()->root_layer()) {
685 scoped_refptr<Layer> root_layer = Layer::Create(); 685 scoped_refptr<Layer> root_layer = Layer::Create();
686 root_layer->SetBounds(gfx::Size(1, 1)); 686 root_layer->SetBounds(gfx::Size(1, 1));
687 layer_tree_host_->SetRootLayer(root_layer); 687 layer_tree()->SetRootLayer(root_layer);
688 } 688 }
689 689
690 gfx::Size root_bounds = layer_tree_host_->root_layer()->bounds(); 690 gfx::Size root_bounds = layer_tree()->root_layer()->bounds();
691 gfx::Size device_root_bounds = gfx::ScaleToCeiledSize( 691 gfx::Size device_root_bounds =
692 root_bounds, layer_tree_host_->device_scale_factor()); 692 gfx::ScaleToCeiledSize(root_bounds, layer_tree()->device_scale_factor());
693 layer_tree_host_->SetViewportSize(device_root_bounds); 693 layer_tree()->SetViewportSize(device_root_bounds);
694 layer_tree_host_->root_layer()->SetIsDrawable(true); 694 layer_tree()->root_layer()->SetIsDrawable(true);
695 } 695 }
696 696
697 void LayerTreeTest::Timeout() { 697 void LayerTreeTest::Timeout() {
698 timed_out_ = true; 698 timed_out_ = true;
699 EndTest(); 699 EndTest();
700 } 700 }
701 701
702 void LayerTreeTest::RealEndTest() { 702 void LayerTreeTest::RealEndTest() {
703 // TODO(mithro): Make this method only end when not inside an impl frame. 703 // TODO(mithro): Make this method only end when not inside an impl frame.
704 bool main_frame_will_happen; 704 bool main_frame_will_happen;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 synchronous_composite, force_disable_reclaim_resources); 867 synchronous_composite, force_disable_reclaim_resources);
868 } 868 }
869 869
870 std::unique_ptr<OutputSurface> LayerTreeTest::CreateDisplayOutputSurface( 870 std::unique_ptr<OutputSurface> LayerTreeTest::CreateDisplayOutputSurface(
871 scoped_refptr<ContextProvider> compositor_context_provider) { 871 scoped_refptr<ContextProvider> compositor_context_provider) {
872 // By default the Display shares a context with the LayerTreeHostImpl. 872 // By default the Display shares a context with the LayerTreeHostImpl.
873 return FakeOutputSurface::Create3d(std::move(compositor_context_provider)); 873 return FakeOutputSurface::Create3d(std::move(compositor_context_provider));
874 } 874 }
875 875
876 void LayerTreeTest::DestroyLayerTreeHost() { 876 void LayerTreeTest::DestroyLayerTreeHost() {
877 if (layer_tree_host_ && layer_tree_host_->root_layer()) 877 if (layer_tree_host_ && layer_tree_host_->GetLayerTree()->root_layer())
878 layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); 878 layer_tree_host_->GetLayerTree()->root_layer()->SetLayerTreeHost(NULL);
879 layer_tree_host_ = nullptr; 879 layer_tree_host_ = nullptr;
880 880
881 DCHECK(!remote_proto_channel_bridge_.channel_main.HasReceiver()); 881 DCHECK(!remote_proto_channel_bridge_.channel_main.HasReceiver());
882 882
883 // Destroying the LayerTreeHost should destroy the remote client 883 // Destroying the LayerTreeHost should destroy the remote client
884 // LayerTreeHost. 884 // LayerTreeHost.
885 DCHECK(!remote_client_layer_tree_host_); 885 DCHECK(!remote_client_layer_tree_host_);
886 } 886 }
887 887
888 void LayerTreeTest::DestroyRemoteClientHost() { 888 void LayerTreeTest::DestroyRemoteClientHost() {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 } 937 }
938 938
939 LayerTreeHost* LayerTreeTest::remote_client_layer_tree_host() { 939 LayerTreeHost* LayerTreeTest::remote_client_layer_tree_host() {
940 DCHECK(IsRemoteTest()); 940 DCHECK(IsRemoteTest());
941 DCHECK(task_runner_provider()->IsMainThread() || 941 DCHECK(task_runner_provider()->IsMainThread() ||
942 task_runner_provider()->IsMainThreadBlocked()); 942 task_runner_provider()->IsMainThreadBlocked());
943 return remote_client_layer_tree_host_.get(); 943 return remote_client_layer_tree_host_.get();
944 } 944 }
945 945
946 } // namespace cc 946 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698