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

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

Issue 2650303002: cc: Remove the LayerTreeHost abstraction. (Closed)
Patch Set: missed ui Created 3 years, 11 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/trees/layer_tree_host_in_process.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 5169 matching lines...) Expand 10 before | Expand all | Expand 10 after
5180 &layer_client_, std::move(recording_source)); 5180 &layer_client_, std::move(recording_source));
5181 layer_ = layer.get(); 5181 layer_ = layer.get();
5182 layer->SetBounds(gfx::Size(10, 10)); 5182 layer->SetBounds(gfx::Size(10, 10));
5183 layer->SetIsDrawable(true); 5183 layer->SetIsDrawable(true);
5184 layer_tree()->root_layer()->AddChild(layer); 5184 layer_tree()->root_layer()->AddChild(layer);
5185 layer_client_.set_bounds(layer_->bounds()); 5185 layer_client_.set_bounds(layer_->bounds());
5186 } 5186 }
5187 5187
5188 void BeginTest() override { 5188 void BeginTest() override {
5189 // Verify default value. 5189 // Verify default value.
5190 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5190 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger());
5191 5191
5192 // Setting gpu rasterization trigger does not enable gpu rasterization. 5192 // Setting gpu rasterization trigger does not enable gpu rasterization.
5193 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5193 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5194 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5194 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
5195 5195
5196 PostSetNeedsCommitToMainThread(); 5196 PostSetNeedsCommitToMainThread();
5197 } 5197 }
5198 5198
5199 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 5199 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
5200 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization()); 5200 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization());
5201 5201
5202 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); 5202 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
5203 EXPECT_FALSE(host_impl->use_gpu_rasterization()); 5203 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5204 } 5204 }
(...skipping 30 matching lines...) Expand all
5235 layer_ = layer.get(); 5235 layer_ = layer.get();
5236 layer->SetBounds(gfx::Size()); 5236 layer->SetBounds(gfx::Size());
5237 layer->SetIsDrawable(true); 5237 layer->SetIsDrawable(true);
5238 layer_tree()->root_layer()->AddChild(layer); 5238 layer_tree()->root_layer()->AddChild(layer);
5239 layer_client_.set_bounds(layer->bounds()); 5239 layer_client_.set_bounds(layer->bounds());
5240 } 5240 }
5241 5241
5242 void BeginTest() override { 5242 void BeginTest() override {
5243 // Setting gpu rasterization trigger does not enable gpu rasterization. 5243 // Setting gpu rasterization trigger does not enable gpu rasterization.
5244 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5244 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5245 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5245 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
5246 5246
5247 PostSetNeedsCommitToMainThread(); 5247 PostSetNeedsCommitToMainThread();
5248 } 5248 }
5249 5249
5250 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 5250 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
5251 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization()); 5251 EXPECT_TRUE(layer_->IsSuitableForGpuRasterization());
5252 5252
5253 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization()); 5253 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
5254 EXPECT_FALSE(host_impl->use_gpu_rasterization()); 5254 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5255 } 5255 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
5290 &layer_client_, std::move(recording_source)); 5290 &layer_client_, std::move(recording_source));
5291 layer_ = layer.get(); 5291 layer_ = layer.get();
5292 layer->SetBounds(gfx::Size(10, 10)); 5292 layer->SetBounds(gfx::Size(10, 10));
5293 layer->SetIsDrawable(true); 5293 layer->SetIsDrawable(true);
5294 layer_tree()->root_layer()->AddChild(layer); 5294 layer_tree()->root_layer()->AddChild(layer);
5295 layer_client_.set_bounds(layer_->bounds()); 5295 layer_client_.set_bounds(layer_->bounds());
5296 } 5296 }
5297 5297
5298 void BeginTest() override { 5298 void BeginTest() override {
5299 // Verify default value. 5299 // Verify default value.
5300 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5300 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger());
5301 5301
5302 // Gpu rasterization trigger is relevant. 5302 // Gpu rasterization trigger is relevant.
5303 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5303 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5304 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5304 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
5305 5305
5306 // Content-based veto is relevant as well. 5306 // Content-based veto is relevant as well.
5307 layer_->set_force_unsuitable_for_gpu_rasterization(true); 5307 layer_->set_force_unsuitable_for_gpu_rasterization(true);
5308 5308
5309 // Veto will take effect when layers are updated. 5309 // Veto will take effect when layers are updated.
5310 // The results will be verified after commit is completed below. 5310 // The results will be verified after commit is completed below.
5311 // Since we are manually marking the source as unsuitable, 5311 // Since we are manually marking the source as unsuitable,
5312 // make sure that the layer gets a chance to update. 5312 // make sure that the layer gets a chance to update.
5313 layer_->SetNeedsDisplay(); 5313 layer_->SetNeedsDisplay();
5314 PostSetNeedsCommitToMainThread(); 5314 PostSetNeedsCommitToMainThread();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5358 &layer_client_, std::move(recording_source)); 5358 &layer_client_, std::move(recording_source));
5359 layer_ = layer.get(); 5359 layer_ = layer.get();
5360 layer->SetBounds(gfx::Size(10, 10)); 5360 layer->SetBounds(gfx::Size(10, 10));
5361 layer->SetIsDrawable(true); 5361 layer->SetIsDrawable(true);
5362 layer_tree()->root_layer()->AddChild(layer); 5362 layer_tree()->root_layer()->AddChild(layer);
5363 layer_client_.set_bounds(layer_->bounds()); 5363 layer_client_.set_bounds(layer_->bounds());
5364 } 5364 }
5365 5365
5366 void BeginTest() override { 5366 void BeginTest() override {
5367 // Verify default value. 5367 // Verify default value.
5368 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5368 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger());
5369 5369
5370 // Gpu rasterization trigger is relevant. 5370 // Gpu rasterization trigger is relevant.
5371 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5371 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5372 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5372 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
5373 5373
5374 // Content-based veto is relevant as well. 5374 // Content-based veto is relevant as well.
5375 layer_->set_force_unsuitable_for_gpu_rasterization(true); 5375 layer_->set_force_unsuitable_for_gpu_rasterization(true);
5376 5376
5377 // Veto will take effect when layers are updated. 5377 // Veto will take effect when layers are updated.
5378 // The results will be verified after commit is completed below. 5378 // The results will be verified after commit is completed below.
5379 // Since we are manually marking the source as unsuitable, 5379 // Since we are manually marking the source as unsuitable,
5380 // make sure that the layer gets a chance to update. 5380 // make sure that the layer gets a chance to update.
5381 layer_->SetNeedsDisplay(); 5381 layer_->SetNeedsDisplay();
5382 PostSetNeedsCommitToMainThread(); 5382 PostSetNeedsCommitToMainThread();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5441 layer_ = layer.get(); 5441 layer_ = layer.get();
5442 5442
5443 layer->SetBounds(gfx::Size(10, 10)); 5443 layer->SetBounds(gfx::Size(10, 10));
5444 layer->SetIsDrawable(true); 5444 layer->SetIsDrawable(true);
5445 layer_tree()->root_layer()->AddChild(layer); 5445 layer_tree()->root_layer()->AddChild(layer);
5446 layer_client_.set_bounds(layer_->bounds()); 5446 layer_client_.set_bounds(layer_->bounds());
5447 } 5447 }
5448 5448
5449 void BeginTest() override { 5449 void BeginTest() override {
5450 // Verify default value. 5450 // Verify default value.
5451 EXPECT_FALSE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5451 EXPECT_FALSE(layer_tree_host()->has_gpu_rasterization_trigger());
5452 5452
5453 // With gpu rasterization forced, gpu rasterization trigger is irrelevant. 5453 // With gpu rasterization forced, gpu rasterization trigger is irrelevant.
5454 layer_tree_host()->SetHasGpuRasterizationTrigger(true); 5454 layer_tree_host()->SetHasGpuRasterizationTrigger(true);
5455 EXPECT_TRUE(layer_tree_host_in_process()->has_gpu_rasterization_trigger()); 5455 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
5456 5456
5457 // Content-based veto is irrelevant as well. 5457 // Content-based veto is irrelevant as well.
5458 layer_->set_force_unsuitable_for_gpu_rasterization(true); 5458 layer_->set_force_unsuitable_for_gpu_rasterization(true);
5459 5459
5460 // Veto will take effect when layers are updated. 5460 // Veto will take effect when layers are updated.
5461 // The results will be verified after commit is completed below. 5461 // The results will be verified after commit is completed below.
5462 // Since we are manually marking the source as unsuitable, 5462 // Since we are manually marking the source as unsuitable,
5463 // make sure that the layer gets a chance to update. 5463 // make sure that the layer gets a chance to update.
5464 layer_->SetNeedsDisplay(); 5464 layer_->SetNeedsDisplay();
5465 PostSetNeedsCommitToMainThread(); 5465 PostSetNeedsCommitToMainThread();
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
5860 layer_tree()->SetRootLayer(nullptr); 5860 layer_tree()->SetRootLayer(nullptr);
5861 info_.page_scale_delta = 3.14f; 5861 info_.page_scale_delta = 3.14f;
5862 info_.top_controls_delta = 2.73f; 5862 info_.top_controls_delta = 2.73f;
5863 5863
5864 PostSetNeedsCommitToMainThread(); 5864 PostSetNeedsCommitToMainThread();
5865 } 5865 }
5866 5866
5867 void BeginMainFrame(const BeginFrameArgs& args) override { 5867 void BeginMainFrame(const BeginFrameArgs& args) override {
5868 EXPECT_EQ(nullptr, layer_tree()->root_layer()); 5868 EXPECT_EQ(nullptr, layer_tree()->root_layer());
5869 5869
5870 layer_tree_host_in_process()->ApplyScrollAndScale(&info_); 5870 layer_tree_host()->ApplyScrollAndScale(&info_);
5871 EndTest(); 5871 EndTest();
5872 } 5872 }
5873 5873
5874 void ApplyViewportDeltas(const gfx::Vector2dF& inner, 5874 void ApplyViewportDeltas(const gfx::Vector2dF& inner,
5875 const gfx::Vector2dF& outer, 5875 const gfx::Vector2dF& outer,
5876 const gfx::Vector2dF& elastic_overscroll_delta, 5876 const gfx::Vector2dF& elastic_overscroll_delta,
5877 float scale_delta, 5877 float scale_delta,
5878 float top_controls_delta) override { 5878 float top_controls_delta) override {
5879 EXPECT_EQ(info_.page_scale_delta, scale_delta); 5879 EXPECT_EQ(info_.page_scale_delta, scale_delta);
5880 EXPECT_EQ(info_.top_controls_delta, top_controls_delta); 5880 EXPECT_EQ(info_.top_controls_delta, top_controls_delta);
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
7117 EndTest(); 7117 EndTest();
7118 } 7118 }
7119 7119
7120 void AfterTest() override {} 7120 void AfterTest() override {}
7121 }; 7121 };
7122 7122
7123 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7123 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7124 7124
7125 } // namespace 7125 } // namespace
7126 } // namespace cc 7126 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_in_process.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