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

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

Issue 1452353002: Turn off computation of the interest rect in cc in synchronized paint mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/test/fake_content_layer_client.h" 7 #include "cc/test/fake_content_layer_client.h"
8 #include "cc/test/fake_picture_layer.h" 8 #include "cc/test/fake_picture_layer.h"
9 #include "cc/test/fake_picture_layer_impl.h" 9 #include "cc/test/fake_picture_layer_impl.h"
10 #include "cc/test/layer_tree_test.h" 10 #include "cc/test/layer_tree_test.h"
11 #include "cc/trees/layer_tree_impl.h" 11 #include "cc/trees/layer_tree_impl.h"
12 12
13 namespace cc { 13 namespace cc {
14 namespace { 14 namespace {
15 15
16 // These tests deal with picture layers. 16 // These tests deal with picture layers.
17 class LayerTreeHostPictureTest : public LayerTreeTest { 17 class LayerTreeHostPictureTest : public LayerTreeTest {
18 protected: 18 protected:
19 void SetupTreeWithSinglePictureLayer(const gfx::Size& size) { 19 void SetupTreeWithSinglePictureLayer(const gfx::Size& size) {
20 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 20 scoped_refptr<Layer> root = Layer::Create(layer_settings());
21 root->SetBounds(size); 21 root->SetBounds(size);
22 22
23 root_picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 23 root_picture_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
24 root_picture_layer_->SetBounds(size); 24 root_picture_layer_->SetBounds(size);
25 root->AddChild(root_picture_layer_); 25 root->AddChild(root_picture_layer_);
26 26
27 layer_tree_host()->SetRootLayer(root); 27 layer_tree_host()->SetRootLayer(root);
28 client_.set_bounds(size);
28 } 29 }
29 30
30 scoped_refptr<FakePictureLayer> root_picture_layer_; 31 scoped_refptr<FakePictureLayer> root_picture_layer_;
31 FakeContentLayerClient client_; 32 FakeContentLayerClient client_;
32 }; 33 };
33 34
34 class LayerTreeHostPictureTestTwinLayer 35 class LayerTreeHostPictureTestTwinLayer
35 : public LayerTreeHostPictureTest { 36 : public LayerTreeHostPictureTest {
36 void SetupTree() override { 37 void SetupTree() override {
37 SetupTreeWithSinglePictureLayer(gfx::Size(1, 1)); 38 SetupTreeWithSinglePictureLayer(gfx::Size(1, 1));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 136
136 class LayerTreeHostPictureTestResizeViewportWithGpuRaster 137 class LayerTreeHostPictureTestResizeViewportWithGpuRaster
137 : public LayerTreeHostPictureTest { 138 : public LayerTreeHostPictureTest {
138 void InitializeSettings(LayerTreeSettings* settings) override { 139 void InitializeSettings(LayerTreeSettings* settings) override {
139 settings->gpu_rasterization_forced = true; 140 settings->gpu_rasterization_forced = true;
140 } 141 }
141 142
142 void SetupTree() override { 143 void SetupTree() override {
143 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 144 scoped_refptr<Layer> root = Layer::Create(layer_settings());
144 root->SetBounds(gfx::Size(768, 960)); 145 root->SetBounds(gfx::Size(768, 960));
145 146 client_.set_bounds(root->bounds());
146 client_.set_fill_with_nonsolid_color(true); 147 client_.set_fill_with_nonsolid_color(true);
147 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 148 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
148 picture_->SetBounds(gfx::Size(768, 960)); 149 picture_->SetBounds(gfx::Size(768, 960));
149 root->AddChild(picture_); 150 root->AddChild(picture_);
150 151
151 layer_tree_host()->SetRootLayer(root); 152 layer_tree_host()->SetRootLayer(root);
152 LayerTreeHostPictureTest::SetupTree(); 153 LayerTreeHostPictureTest::SetupTree();
153 } 154 }
154 155
155 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 156 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 LayerTreeHostPictureTestResizeViewportWithGpuRaster); 199 LayerTreeHostPictureTestResizeViewportWithGpuRaster);
199 200
200 class LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree 201 class LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree
201 : public LayerTreeHostPictureTest { 202 : public LayerTreeHostPictureTest {
202 void SetupTree() override { 203 void SetupTree() override {
203 frame_ = 0; 204 frame_ = 0;
204 did_post_commit_ = false; 205 did_post_commit_ = false;
205 206
206 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 207 scoped_refptr<Layer> root = Layer::Create(layer_settings());
207 root->SetBounds(gfx::Size(100, 100)); 208 root->SetBounds(gfx::Size(100, 100));
208
209 // The layer is big enough that the live tiles rect won't cover the full 209 // The layer is big enough that the live tiles rect won't cover the full
210 // layer. 210 // layer.
211 client_.set_fill_with_nonsolid_color(true); 211 client_.set_fill_with_nonsolid_color(true);
212 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 212 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
213 picture_->SetBounds(gfx::Size(100, 100000)); 213 picture_->SetBounds(gfx::Size(100, 100000));
214 root->AddChild(picture_); 214 root->AddChild(picture_);
215 215
216 // picture_'s transform is going to be changing on the compositor thread, so 216 // picture_'s transform is going to be changing on the compositor thread, so
217 // force it to have a transform node by making it scrollable. 217 // force it to have a transform node by making it scrollable.
218 picture_->SetScrollClipLayerId(root->id()); 218 picture_->SetScrollClipLayerId(root->id());
219 219
220 layer_tree_host()->SetRootLayer(root); 220 layer_tree_host()->SetRootLayer(root);
221 LayerTreeHostPictureTest::SetupTree(); 221 LayerTreeHostPictureTest::SetupTree();
222 client_.set_bounds(picture_->bounds());
222 } 223 }
223 224
224 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 225 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
225 226
226 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 227 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
227 LayerImpl* child = impl->active_tree()->root_layer()->children()[0].get(); 228 LayerImpl* child = impl->active_tree()->root_layer()->children()[0].get();
228 FakePictureLayerImpl* picture_impl = 229 FakePictureLayerImpl* picture_impl =
229 static_cast<FakePictureLayerImpl*>(child); 230 static_cast<FakePictureLayerImpl*>(child);
230 switch (++frame_) { 231 switch (++frame_) {
231 case 1: { 232 case 1: {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 scoped_refptr<FakePictureLayer> picture_; 305 scoped_refptr<FakePictureLayer> picture_;
305 }; 306 };
306 307
307 // Multi-thread only since there is no recycle tree in single thread. 308 // Multi-thread only since there is no recycle tree in single thread.
308 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree); 309 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree);
309 310
310 class LayerTreeHostPictureTestRSLLMembership : public LayerTreeHostPictureTest { 311 class LayerTreeHostPictureTestRSLLMembership : public LayerTreeHostPictureTest {
311 void SetupTree() override { 312 void SetupTree() override {
312 scoped_refptr<Layer> root = Layer::Create(layer_settings()); 313 scoped_refptr<Layer> root = Layer::Create(layer_settings());
313 root->SetBounds(gfx::Size(100, 100)); 314 root->SetBounds(gfx::Size(100, 100));
315 client_.set_bounds(root->bounds());
314 316
315 child_ = Layer::Create(layer_settings()); 317 child_ = Layer::Create(layer_settings());
316 root->AddChild(child_); 318 root->AddChild(child_);
317 319
318 // Don't be solid color so the layer has tilings/tiles. 320 // Don't be solid color so the layer has tilings/tiles.
319 client_.set_fill_with_nonsolid_color(true); 321 client_.set_fill_with_nonsolid_color(true);
320 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 322 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
321 picture_->SetBounds(gfx::Size(100, 100)); 323 picture_->SetBounds(gfx::Size(100, 100));
322 child_->AddChild(picture_); 324 child_->AddChild(picture_);
323 325
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 // Don't be solid color so the layer has tilings/tiles. 412 // Don't be solid color so the layer has tilings/tiles.
411 client_.set_fill_with_nonsolid_color(true); 413 client_.set_fill_with_nonsolid_color(true);
412 picture_ = FakePictureLayer::Create(layer_settings(), &client_); 414 picture_ = FakePictureLayer::Create(layer_settings(), &client_);
413 picture_->SetBounds(gfx::Size(100, 100)); 415 picture_->SetBounds(gfx::Size(100, 100));
414 pinch_->AddChild(picture_); 416 pinch_->AddChild(picture_);
415 417
416 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch_, nullptr); 418 layer_tree_host()->RegisterViewportLayers(NULL, root, pinch_, nullptr);
417 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f); 419 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 1.f, 4.f);
418 layer_tree_host()->SetRootLayer(root); 420 layer_tree_host()->SetRootLayer(root);
419 LayerTreeHostPictureTest::SetupTree(); 421 LayerTreeHostPictureTest::SetupTree();
422 client_.set_bounds(picture_->bounds());
420 } 423 }
421 424
422 void InitializeSettings(LayerTreeSettings* settings) override { 425 void InitializeSettings(LayerTreeSettings* settings) override {
423 settings->layer_transforms_should_scale_layer_contents = true; 426 settings->layer_transforms_should_scale_layer_contents = true;
424 } 427 }
425 428
426 void BeginTest() override { 429 void BeginTest() override {
427 frame_ = 0; 430 frame_ = 0;
428 draws_in_frame_ = 0; 431 draws_in_frame_ = 0;
429 last_frame_drawn_ = -1; 432 last_frame_drawn_ = -1;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 int last_frame_drawn_; 560 int last_frame_drawn_;
558 bool ready_to_draw_; 561 bool ready_to_draw_;
559 }; 562 };
560 563
561 // Multi-thread only because in single thread you can't pinch zoom on the 564 // Multi-thread only because in single thread you can't pinch zoom on the
562 // compositor thread. 565 // compositor thread.
563 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale); 566 MULTI_THREAD_TEST_F(LayerTreeHostPictureTestRSLLMembershipWithScale);
564 567
565 } // namespace 568 } // namespace
566 } // namespace cc 569 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_occlusion.cc ('k') | cc/trees/layer_tree_host_unittest_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698