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

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

Issue 2400733002: cc: Restructure access to LayerTreeHost in LayerTreeTests. (Closed)
Patch Set: Created 4 years, 2 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_tree_test.cc ('k') | cc/trees/layer_tree_host_unittest_animation.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 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 5129 matching lines...) Expand 10 before | Expand all | Expand 10 after
5140 &layer_client_, std::move(recording_source)); 5140 &layer_client_, std::move(recording_source));
5141 layer_ = layer.get(); 5141 layer_ = layer.get();
5142 layer->SetBounds(gfx::Size(10, 10)); 5142 layer->SetBounds(gfx::Size(10, 10));
5143 layer->SetIsDrawable(true); 5143 layer->SetIsDrawable(true);
5144 layer_tree()->root_layer()->AddChild(layer); 5144 layer_tree()->root_layer()->AddChild(layer);
5145 layer_client_.set_bounds(layer_->bounds()); 5145 layer_client_.set_bounds(layer_->bounds());
5146 } 5146 }
5147 5147
5148 void BeginTest() override { 5148 void BeginTest() override {
5149 // Verify default value. 5149 // Verify default value.
5150 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); 5150 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5151 5151
5152 // Setting gpu rasterization trigger does not enable gpu rasterization. 5152 // Setting gpu rasterization trigger does not enable gpu rasterization.
5153 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5153 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5154 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 5154 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5155 5155
5156 PostSetNeedsCommitToMainThread(); 5156 PostSetNeedsCommitToMainThread();
5157 } 5157 }
5158 5158
5159 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 5159 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
5160 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization()); 5160 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization());
5161 5161
5162 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); 5162 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
5163 EXPECT_FALSE(host_impl->use_gpu_rasterization()); 5163 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5164 } 5164 }
(...skipping 30 matching lines...) Expand all
5195 layer_ = layer.get(); 5195 layer_ = layer.get();
5196 layer->SetBounds(gfx::Size()); 5196 layer->SetBounds(gfx::Size());
5197 layer->SetIsDrawable(true); 5197 layer->SetIsDrawable(true);
5198 layer_tree()->root_layer()->AddChild(layer); 5198 layer_tree()->root_layer()->AddChild(layer);
5199 layer_client_.set_bounds(layer->bounds()); 5199 layer_client_.set_bounds(layer->bounds());
5200 } 5200 }
5201 5201
5202 void BeginTest() override { 5202 void BeginTest() override {
5203 // Setting gpu rasterization trigger does not enable gpu rasterization. 5203 // Setting gpu rasterization trigger does not enable gpu rasterization.
5204 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5204 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5205 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 5205 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5206 5206
5207 PostSetNeedsCommitToMainThread(); 5207 PostSetNeedsCommitToMainThread();
5208 } 5208 }
5209 5209
5210 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 5210 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
5211 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization()); 5211 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization());
5212 5212
5213 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); 5213 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
5214 EXPECT_FALSE(host_impl->use_gpu_rasterization()); 5214 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5215 } 5215 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
5250 &layer_client_, std::move(recording_source)); 5250 &layer_client_, std::move(recording_source));
5251 layer_ = layer.get(); 5251 layer_ = layer.get();
5252 layer->SetBounds(gfx::Size(10, 10)); 5252 layer->SetBounds(gfx::Size(10, 10));
5253 layer->SetIsDrawable(true); 5253 layer->SetIsDrawable(true);
5254 layer_tree()->root_layer()->AddChild(layer); 5254 layer_tree()->root_layer()->AddChild(layer);
5255 layer_client_.set_bounds(layer_->bounds()); 5255 layer_client_.set_bounds(layer_->bounds());
5256 } 5256 }
5257 5257
5258 void BeginTest() override { 5258 void BeginTest() override {
5259 // Verify default value. 5259 // Verify default value.
5260 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); 5260 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5261 5261
5262 // Gpu rasterization trigger is relevant. 5262 // Gpu rasterization trigger is relevant.
5263 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5263 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5264 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 5264 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5265 5265
5266 // Content-based veto is relevant as well. 5266 // Content-based veto is relevant as well.
5267 layer_->set_force_unsuitable_for_gpu_rasterization(true); 5267 layer_->set_force_unsuitable_for_gpu_rasterization(true);
5268 5268
5269 // Veto will take effect when layers are updated. 5269 // Veto will take effect when layers are updated.
5270 // The results will be verified after commit is completed below. 5270 // The results will be verified after commit is completed below.
5271 // Since we are manually marking the source as unsuitable, 5271 // Since we are manually marking the source as unsuitable,
5272 // make sure that the layer gets a chance to update. 5272 // make sure that the layer gets a chance to update.
5273 layer_->SetNeedsDisplay(); 5273 layer_->SetNeedsDisplay();
5274 PostSetNeedsCommitToMainThread(); 5274 PostSetNeedsCommitToMainThread();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5318 &layer_client_, std::move(recording_source)); 5318 &layer_client_, std::move(recording_source));
5319 layer_ = layer.get(); 5319 layer_ = layer.get();
5320 layer->SetBounds(gfx::Size(10, 10)); 5320 layer->SetBounds(gfx::Size(10, 10));
5321 layer->SetIsDrawable(true); 5321 layer->SetIsDrawable(true);
5322 layer_tree()->root_layer()->AddChild(layer); 5322 layer_tree()->root_layer()->AddChild(layer);
5323 layer_client_.set_bounds(layer_->bounds()); 5323 layer_client_.set_bounds(layer_->bounds());
5324 } 5324 }
5325 5325
5326 void BeginTest() override { 5326 void BeginTest() override {
5327 // Verify default value. 5327 // Verify default value.
5328 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); 5328 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5329 5329
5330 // Gpu rasterization trigger is relevant. 5330 // Gpu rasterization trigger is relevant.
5331 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5331 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5332 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 5332 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5333 5333
5334 // Content-based veto is relevant as well. 5334 // Content-based veto is relevant as well.
5335 layer_->set_force_unsuitable_for_gpu_rasterization(true); 5335 layer_->set_force_unsuitable_for_gpu_rasterization(true);
5336 5336
5337 // Veto will take effect when layers are updated. 5337 // Veto will take effect when layers are updated.
5338 // The results will be verified after commit is completed below. 5338 // The results will be verified after commit is completed below.
5339 // Since we are manually marking the source as unsuitable, 5339 // Since we are manually marking the source as unsuitable,
5340 // make sure that the layer gets a chance to update. 5340 // make sure that the layer gets a chance to update.
5341 layer_->SetNeedsDisplay(); 5341 layer_->SetNeedsDisplay();
5342 PostSetNeedsCommitToMainThread(); 5342 PostSetNeedsCommitToMainThread();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5401 layer_ = layer.get(); 5401 layer_ = layer.get();
5402 5402
5403 layer->SetBounds(gfx::Size(10, 10)); 5403 layer->SetBounds(gfx::Size(10, 10));
5404 layer->SetIsDrawable(true); 5404 layer->SetIsDrawable(true);
5405 layer_tree()->root_layer()->AddChild(layer); 5405 layer_tree()->root_layer()->AddChild(layer);
5406 layer_client_.set_bounds(layer_->bounds()); 5406 layer_client_.set_bounds(layer_->bounds());
5407 } 5407 }
5408 5408
5409 void BeginTest() override { 5409 void BeginTest() override {
5410 // Verify default value. 5410 // Verify default value.
5411 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger()); 5411 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5412 5412
5413 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. 5413 // With gpu rasterization forced, gpu rasterization trigger is irrelevant.
5414 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5414 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5415 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 5415 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger());
5416 5416
5417 // Content-based veto is irrelevant as well. 5417 // Content-based veto is irrelevant as well.
5418 layer_->set_force_unsuitable_for_gpu_rasterization(true); 5418 layer_->set_force_unsuitable_for_gpu_rasterization(true);
5419 5419
5420 // Veto will take effect when layers are updated. 5420 // Veto will take effect when layers are updated.
5421 // The results will be verified after commit is completed below. 5421 // The results will be verified after commit is completed below.
5422 // Since we are manually marking the source as unsuitable, 5422 // Since we are manually marking the source as unsuitable,
5423 // make sure that the layer gets a chance to update. 5423 // make sure that the layer gets a chance to update.
5424 layer_->SetNeedsDisplay(); 5424 layer_->SetNeedsDisplay();
5425 PostSetNeedsCommitToMainThread(); 5425 PostSetNeedsCommitToMainThread();
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
5745 layer_tree()->SetRootLayer(nullptr); 5745 layer_tree()->SetRootLayer(nullptr);
5746 info_.page_scale_delta = 3.14f; 5746 info_.page_scale_delta = 3.14f;
5747 info_.top_controls_delta = 2.73f; 5747 info_.top_controls_delta = 2.73f;
5748 5748
5749 PostSetNeedsCommitToMainThread(); 5749 PostSetNeedsCommitToMainThread();
5750 } 5750 }
5751 5751
5752 void BeginMainFrame(const BeginFrameArgs& args) override { 5752 void BeginMainFrame(const BeginFrameArgs& args) override {
5753 EXPECT_EQ(nullptr, layer_tree()->root_layer()); 5753 EXPECT_EQ(nullptr, layer_tree()->root_layer());
5754 5754
5755 layer_tree_host()->ApplyScrollAndScale(&info_); 5755 layer_tree_host_in_process()->ApplyScrollAndScale(&info_);
5756 EndTest(); 5756 EndTest();
5757 } 5757 }
5758 5758
5759 void ApplyViewportDeltas(const gfx::Vector2dF& inner, 5759 void ApplyViewportDeltas(const gfx::Vector2dF& inner,
5760 const gfx::Vector2dF& outer, 5760 const gfx::Vector2dF& outer,
5761 const gfx::Vector2dF& elastic_overscroll_delta, 5761 const gfx::Vector2dF& elastic_overscroll_delta,
5762 float scale_delta, 5762 float scale_delta,
5763 float top_controls_delta) override { 5763 float top_controls_delta) override {
5764 EXPECT_EQ(info_.page_scale_delta, scale_delta); 5764 EXPECT_EQ(info_.page_scale_delta, scale_delta);
5765 EXPECT_EQ(info_.top_controls_delta, top_controls_delta); 5765 EXPECT_EQ(info_.top_controls_delta, top_controls_delta);
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
7006 EndTest(); 7006 EndTest();
7007 } 7007 }
7008 7008
7009 void AfterTest() override {} 7009 void AfterTest() override {}
7010 }; 7010 };
7011 7011
7012 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7012 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7013 7013
7014 } // namespace 7014 } // namespace
7015 } // namespace cc 7015 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_test.cc ('k') | cc/trees/layer_tree_host_unittest_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698