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

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

Issue 290573007: cc: Move gpu rasterization flag from tree-impl to tree-host-impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated unittests Created 6 years, 7 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 | Annotate | Revision Log
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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 5027 matching lines...) Expand 10 before | Expand all | Expand 10 after
5038 5038
5039 // Setting gpu rasterization trigger does not enable gpu rasterization. 5039 // Setting gpu rasterization trigger does not enable gpu rasterization.
5040 layer_tree_host()->set_has_gpu_rasterization_trigger(true); 5040 layer_tree_host()->set_has_gpu_rasterization_trigger(true);
5041 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger()); 5041 EXPECT_TRUE(layer_tree_host()->has_gpu_rasterization_trigger());
5042 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization()); 5042 EXPECT_FALSE(layer_tree_host()->UseGpuRasterization());
5043 5043
5044 PostSetNeedsCommitToMainThread(); 5044 PostSetNeedsCommitToMainThread();
5045 } 5045 }
5046 5046
5047 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 5047 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
5048 LayerImpl* root = host_impl->pending_tree()->root_layer(); 5048 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
5049 PictureLayerImpl* layer_impl = 5049 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5050 static_cast<PictureLayerImpl*>(root->children()[0]);
5051
5052 EXPECT_FALSE(layer_impl->use_gpu_rasterization());
5053 } 5050 }
5054 5051
5055 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 5052 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
5056 LayerImpl* root = host_impl->active_tree()->root_layer(); 5053 EXPECT_FALSE(host_impl->active_tree()->use_gpu_rasterization());
5057 PictureLayerImpl* layer_impl = 5054 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5058 static_cast<PictureLayerImpl*>(root->children()[0]);
5059
5060 EXPECT_FALSE(layer_impl->use_gpu_rasterization());
5061 EndTest(); 5055 EndTest();
5062 } 5056 }
5063 5057
5064 virtual void AfterTest() OVERRIDE {} 5058 virtual void AfterTest() OVERRIDE {}
5065 5059
5066 FakeContentLayerClient layer_client_; 5060 FakeContentLayerClient layer_client_;
5067 }; 5061 };
5068 5062
5069 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationDefault); 5063 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationDefault);
5070 5064
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5109 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); 5103 EXPECT_FALSE(layer->IsSuitableForGpuRasterization());
5110 // Veto will take effect when layers are updated. 5104 // Veto will take effect when layers are updated.
5111 // The results will be verified after commit is completed below. 5105 // The results will be verified after commit is completed below.
5112 // Since we are manually marking picture pile as unsuitable, 5106 // Since we are manually marking picture pile as unsuitable,
5113 // make sure that the layer gets a chance to update. 5107 // make sure that the layer gets a chance to update.
5114 layer->SetNeedsDisplay(); 5108 layer->SetNeedsDisplay();
5115 PostSetNeedsCommitToMainThread(); 5109 PostSetNeedsCommitToMainThread();
5116 } 5110 }
5117 5111
5118 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 5112 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
5119 LayerImpl* root = host_impl->pending_tree()->root_layer(); 5113 EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
5120 PictureLayerImpl* layer_impl = 5114 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5121 static_cast<PictureLayerImpl*>(root->children()[0]);
5122
5123 EXPECT_FALSE(layer_impl->use_gpu_rasterization());
5124 } 5115 }
5125 5116
5126 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 5117 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
5127 LayerImpl* root = host_impl->active_tree()->root_layer(); 5118 EXPECT_FALSE(host_impl->active_tree()->use_gpu_rasterization());
5128 PictureLayerImpl* layer_impl = 5119 EXPECT_FALSE(host_impl->use_gpu_rasterization());
5129 static_cast<PictureLayerImpl*>(root->children()[0]);
5130
5131 EXPECT_FALSE(layer_impl->use_gpu_rasterization());
5132 EndTest(); 5120 EndTest();
5133 } 5121 }
5134 5122
5135 virtual void AfterTest() OVERRIDE {} 5123 virtual void AfterTest() OVERRIDE {}
5136 5124
5137 FakeContentLayerClient layer_client_; 5125 FakeContentLayerClient layer_client_;
5138 }; 5126 };
5139 5127
5140 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); 5128 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled);
5141 5129
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5180 EXPECT_FALSE(layer->IsSuitableForGpuRasterization()); 5168 EXPECT_FALSE(layer->IsSuitableForGpuRasterization());
5181 // Veto will take effect when layers are updated. 5169 // Veto will take effect when layers are updated.
5182 // The results will be verified after commit is completed below. 5170 // The results will be verified after commit is completed below.
5183 // Since we are manually marking picture pile as unsuitable, 5171 // Since we are manually marking picture pile as unsuitable,
5184 // make sure that the layer gets a chance to update. 5172 // make sure that the layer gets a chance to update.
5185 layer->SetNeedsDisplay(); 5173 layer->SetNeedsDisplay();
5186 PostSetNeedsCommitToMainThread(); 5174 PostSetNeedsCommitToMainThread();
5187 } 5175 }
5188 5176
5189 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 5177 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
5190 LayerImpl* root = host_impl->pending_tree()->root_layer(); 5178 EXPECT_TRUE(host_impl->pending_tree()->use_gpu_rasterization());
5191 PictureLayerImpl* layer_impl = 5179 EXPECT_TRUE(host_impl->use_gpu_rasterization());
5192 static_cast<PictureLayerImpl*>(root->children()[0]);
5193
5194 EXPECT_TRUE(layer_impl->use_gpu_rasterization());
5195 } 5180 }
5196 5181
5197 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 5182 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
5198 LayerImpl* root = host_impl->active_tree()->root_layer(); 5183 EXPECT_TRUE(host_impl->active_tree()->use_gpu_rasterization());
5199 PictureLayerImpl* layer_impl = 5184 EXPECT_TRUE(host_impl->use_gpu_rasterization());
5200 static_cast<PictureLayerImpl*>(root->children()[0]);
5201
5202 EXPECT_TRUE(layer_impl->use_gpu_rasterization());
5203 EndTest(); 5185 EndTest();
5204 } 5186 }
5205 5187
5206 virtual void AfterTest() OVERRIDE {} 5188 virtual void AfterTest() OVERRIDE {}
5207 5189
5208 FakeContentLayerClient layer_client_; 5190 FakeContentLayerClient layer_client_;
5209 }; 5191 };
5210 5192
5211 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationForced); 5193 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationForced);
5212 5194
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
5283 const gfx::Size bounds_; 5265 const gfx::Size bounds_;
5284 FakeContentLayerClient client_; 5266 FakeContentLayerClient client_;
5285 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; 5267 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_;
5286 scoped_refptr<FakePictureLayer> picture_layer_; 5268 scoped_refptr<FakePictureLayer> picture_layer_;
5287 Layer* child_layer_; 5269 Layer* child_layer_;
5288 }; 5270 };
5289 5271
5290 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); 5272 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting);
5291 5273
5292 } // namespace cc 5274 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698