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

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

Issue 2080223010: cc: Clean up root_layer code in LTI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase++ Created 4 years, 5 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/test/layer_test_common.h ('k') | cc/test/layer_tree_json_parser_unittest.cc » ('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 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/test/layer_test_common.h" 5 #include "cc/test/layer_test_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/animation/animation_host.h" 9 #include "cc/animation/animation_host.h"
10 #include "cc/animation/animation_id_provider.h" 10 #include "cc/animation/animation_id_provider.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 : LayerImplTest(LayerTreeSettingsForTesting()) {} 119 : LayerImplTest(LayerTreeSettingsForTesting()) {}
120 120
121 LayerTestCommon::LayerImplTest::LayerImplTest(const LayerTreeSettings& settings) 121 LayerTestCommon::LayerImplTest::LayerImplTest(const LayerTreeSettings& settings)
122 : client_(FakeLayerTreeHostClient::DIRECT_3D), 122 : client_(FakeLayerTreeHostClient::DIRECT_3D),
123 output_surface_(FakeOutputSurface::Create3d()), 123 output_surface_(FakeOutputSurface::Create3d()),
124 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_, settings)), 124 host_(FakeLayerTreeHost::Create(&client_, &task_graph_runner_, settings)),
125 render_pass_(RenderPass::Create()), 125 render_pass_(RenderPass::Create()),
126 layer_impl_id_(2) { 126 layer_impl_id_(2) {
127 std::unique_ptr<LayerImpl> root = 127 std::unique_ptr<LayerImpl> root =
128 LayerImpl::Create(host_->host_impl()->active_tree(), 1); 128 LayerImpl::Create(host_->host_impl()->active_tree(), 1);
129 host_->host_impl()->active_tree()->SetRootLayer(std::move(root)); 129 host_->host_impl()->active_tree()->SetRootLayerForTesting(std::move(root));
130 root_layer()->SetHasRenderSurface(true); 130 root_layer_for_testing()->SetHasRenderSurface(true);
131 host_->host_impl()->SetVisible(true); 131 host_->host_impl()->SetVisible(true);
132 host_->host_impl()->InitializeRenderer(output_surface_.get()); 132 host_->host_impl()->InitializeRenderer(output_surface_.get());
133 133
134 const int timeline_id = AnimationIdProvider::NextTimelineId(); 134 const int timeline_id = AnimationIdProvider::NextTimelineId();
135 timeline_ = AnimationTimeline::Create(timeline_id); 135 timeline_ = AnimationTimeline::Create(timeline_id);
136 host_->animation_host()->AddAnimationTimeline(timeline_); 136 host_->animation_host()->AddAnimationTimeline(timeline_);
137 // Create impl-side instance. 137 // Create impl-side instance.
138 host_->animation_host()->PushPropertiesTo( 138 host_->animation_host()->PushPropertiesTo(
139 host_->host_impl()->animation_host()); 139 host_->host_impl()->animation_host());
140 timeline_impl_ = 140 timeline_impl_ =
141 host_->host_impl()->animation_host()->GetTimelineById(timeline_id); 141 host_->host_impl()->animation_host()->GetTimelineById(timeline_id);
142 } 142 }
143 143
144 LayerTestCommon::LayerImplTest::~LayerImplTest() { 144 LayerTestCommon::LayerImplTest::~LayerImplTest() {
145 host_->animation_host()->RemoveAnimationTimeline(timeline_); 145 host_->animation_host()->RemoveAnimationTimeline(timeline_);
146 timeline_ = nullptr; 146 timeline_ = nullptr;
147 } 147 }
148 148
149 void LayerTestCommon::LayerImplTest::CalcDrawProps( 149 void LayerTestCommon::LayerImplTest::CalcDrawProps(
150 const gfx::Size& viewport_size) { 150 const gfx::Size& viewport_size) {
151 LayerImplList layer_list; 151 LayerImplList layer_list;
152 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 152 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
153 root_layer(), viewport_size, &layer_list); 153 root_layer_for_testing(), viewport_size, &layer_list);
154 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 154 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
155 } 155 }
156 156
157 void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion( 157 void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion(
158 LayerImpl* layer_impl, 158 LayerImpl* layer_impl,
159 const gfx::Rect& occluded) { 159 const gfx::Rect& occluded) {
160 AppendQuadsData data; 160 AppendQuadsData data;
161 161
162 render_pass_->quad_list.clear(); 162 render_pass_->quad_list.clear();
163 render_pass_->shared_quad_state_list.clear(); 163 render_pass_->shared_quad_state_list.clear();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 surface_impl->AppendQuads( 200 surface_impl->AppendQuads(
201 render_pass_.get(), gfx::Transform(), 201 render_pass_.get(), gfx::Transform(),
202 Occlusion(gfx::Transform(), SimpleEnclosedRegion(occluded), 202 Occlusion(gfx::Transform(), SimpleEnclosedRegion(occluded),
203 SimpleEnclosedRegion()), 203 SimpleEnclosedRegion()),
204 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1)); 204 SK_ColorBLACK, 1.f, nullptr, &data, RenderPassId(1, 1));
205 } 205 }
206 206
207 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {} 207 void EmptyCopyOutputCallback(std::unique_ptr<CopyOutputResult> result) {}
208 208
209 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() { 209 void LayerTestCommon::LayerImplTest::RequestCopyOfOutput() {
210 root_layer()->test_properties()->copy_requests.push_back( 210 root_layer_for_testing()->test_properties()->copy_requests.push_back(
211 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback))); 211 CopyOutputRequest::CreateRequest(base::Bind(&EmptyCopyOutputCallback)));
212 } 212 }
213 213
214 } // namespace cc 214 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_test_common.h ('k') | cc/test/layer_tree_json_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698