OLD | NEW |
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 settings->layer_transforms_should_scale_layer_contents = true; | 389 settings->layer_transforms_should_scale_layer_contents = true; |
390 } | 390 } |
391 | 391 |
392 virtual void SetupTree() OVERRIDE { | 392 virtual void SetupTree() OVERRIDE { |
393 root_layer_ = Layer::Create(); | 393 root_layer_ = Layer::Create(); |
394 root_layer_->SetBounds(gfx::Size(10, 20)); | 394 root_layer_->SetBounds(gfx::Size(10, 20)); |
395 | 395 |
396 bool paint_scrollbar = true; | 396 bool paint_scrollbar = true; |
397 bool has_thumb = false; | 397 bool has_thumb = false; |
398 scrollbar_ = FakePaintedScrollbarLayer::Create( | 398 scrollbar_ = FakePaintedScrollbarLayer::Create( |
399 paint_scrollbar, has_thumb, root_layer_->id()); | 399 paint_scrollbar, has_thumb, root_layer_.get()); |
400 scrollbar_->SetPosition(gfx::Point(0, 10)); | 400 scrollbar_->SetPosition(gfx::Point(0, 10)); |
401 scrollbar_->SetBounds(gfx::Size(10, 10)); | 401 scrollbar_->SetBounds(gfx::Size(10, 10)); |
402 | 402 |
403 root_layer_->AddChild(scrollbar_); | 403 root_layer_->AddChild(scrollbar_); |
404 | 404 |
405 layer_tree_host()->SetRootLayer(root_layer_); | 405 layer_tree_host()->SetRootLayer(root_layer_); |
406 LayerTreeHostTest::SetupTree(); | 406 LayerTreeHostTest::SetupTree(); |
407 } | 407 } |
408 | 408 |
409 virtual void BeginTest() OVERRIDE { | 409 virtual void BeginTest() OVERRIDE { |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. | 1038 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
1039 class DISABLED_LayerTreeHostTestStartPageScaleAnimation | 1039 class DISABLED_LayerTreeHostTestStartPageScaleAnimation |
1040 : public LayerTreeHostTest { | 1040 : public LayerTreeHostTest { |
1041 public: | 1041 public: |
1042 DISABLED_LayerTreeHostTestStartPageScaleAnimation() {} | 1042 DISABLED_LayerTreeHostTestStartPageScaleAnimation() {} |
1043 | 1043 |
1044 virtual void SetupTree() OVERRIDE { | 1044 virtual void SetupTree() OVERRIDE { |
1045 LayerTreeHostTest::SetupTree(); | 1045 LayerTreeHostTest::SetupTree(); |
1046 | 1046 |
1047 scroll_layer_ = FakeContentLayer::Create(&client_); | 1047 scroll_layer_ = FakeContentLayer::Create(&client_); |
1048 scroll_layer_->SetScrollable(true); | 1048 scroll_layer_->SetScrollable(scroll_layer_->parent()); // WJM |
1049 scroll_layer_->SetScrollOffset(gfx::Vector2d()); | 1049 scroll_layer_->SetScrollOffset(gfx::Vector2d()); |
1050 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 1050 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
1051 } | 1051 } |
1052 | 1052 |
1053 virtual void BeginTest() OVERRIDE { | 1053 virtual void BeginTest() OVERRIDE { |
1054 PostSetNeedsCommitToMainThread(); | 1054 PostSetNeedsCommitToMainThread(); |
1055 } | 1055 } |
1056 | 1056 |
1057 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) | 1057 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) |
1058 OVERRIDE { | 1058 OVERRIDE { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 settings->scrollbar_animator = LayerTreeSettings::NoAnimator; | 1352 settings->scrollbar_animator = LayerTreeSettings::NoAnimator; |
1353 } | 1353 } |
1354 | 1354 |
1355 virtual void SetupTree() OVERRIDE { | 1355 virtual void SetupTree() OVERRIDE { |
1356 layer_ = FakeContentLayer::Create(&client_); | 1356 layer_ = FakeContentLayer::Create(&client_); |
1357 layer_->SetBounds(gfx::Size(10, 20)); | 1357 layer_->SetBounds(gfx::Size(10, 20)); |
1358 | 1358 |
1359 bool paint_scrollbar = true; | 1359 bool paint_scrollbar = true; |
1360 bool has_thumb = false; | 1360 bool has_thumb = false; |
1361 scrollbar_ = FakePaintedScrollbarLayer::Create( | 1361 scrollbar_ = FakePaintedScrollbarLayer::Create( |
1362 paint_scrollbar, has_thumb, layer_->id()); | 1362 paint_scrollbar, has_thumb, layer_); |
1363 scrollbar_->SetPosition(gfx::Point(0, 10)); | 1363 scrollbar_->SetPosition(gfx::Point(0, 10)); |
1364 scrollbar_->SetBounds(gfx::Size(10, 10)); | 1364 scrollbar_->SetBounds(gfx::Size(10, 10)); |
1365 | 1365 |
1366 layer_->AddChild(scrollbar_); | 1366 layer_->AddChild(scrollbar_); |
1367 | 1367 |
1368 layer_tree_host()->SetRootLayer(layer_); | 1368 layer_tree_host()->SetRootLayer(layer_); |
1369 LayerTreeHostTest::SetupTree(); | 1369 LayerTreeHostTest::SetupTree(); |
1370 } | 1370 } |
1371 | 1371 |
1372 virtual void BeginTest() OVERRIDE { | 1372 virtual void BeginTest() OVERRIDE { |
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3985 PostSetNeedsCommitToMainThread(); | 3985 PostSetNeedsCommitToMainThread(); |
3986 } | 3986 } |
3987 | 3987 |
3988 virtual void SetupTree() OVERRIDE { | 3988 virtual void SetupTree() OVERRIDE { |
3989 root_ = Layer::Create(); | 3989 root_ = Layer::Create(); |
3990 root_->SetBounds(gfx::Size(1, 1)); | 3990 root_->SetBounds(gfx::Size(1, 1)); |
3991 | 3991 |
3992 bool paint_scrollbar = true; | 3992 bool paint_scrollbar = true; |
3993 bool has_thumb = false; | 3993 bool has_thumb = false; |
3994 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( | 3994 scrollbar_layer_ = FakePaintedScrollbarLayer::Create( |
3995 paint_scrollbar, has_thumb, root_->id()); | 3995 paint_scrollbar, has_thumb, root_.get()); |
3996 | 3996 |
3997 root_->AddChild(scrollbar_layer_); | 3997 root_->AddChild(scrollbar_layer_); |
3998 | 3998 |
3999 layer_tree_host()->SetRootLayer(root_); | 3999 layer_tree_host()->SetRootLayer(root_); |
4000 LayerTreeHostTest::SetupTree(); | 4000 LayerTreeHostTest::SetupTree(); |
4001 } | 4001 } |
4002 | 4002 |
4003 virtual void DidCommitAndDrawFrame() OVERRIDE { | 4003 virtual void DidCommitAndDrawFrame() OVERRIDE { |
4004 switch (layer_tree_host()->source_frame_number()) { | 4004 switch (layer_tree_host()->source_frame_number()) { |
4005 case 0: | 4005 case 0: |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5101 size_t second_output_surface_memory_limit_; | 5101 size_t second_output_surface_memory_limit_; |
5102 FakeContentLayerClient client_; | 5102 FakeContentLayerClient client_; |
5103 scoped_refptr<FakeContentLayer> root_; | 5103 scoped_refptr<FakeContentLayer> root_; |
5104 }; | 5104 }; |
5105 | 5105 |
5106 // No output to copy for delegated renderers. | 5106 // No output to copy for delegated renderers. |
5107 SINGLE_AND_MULTI_THREAD_TEST_F( | 5107 SINGLE_AND_MULTI_THREAD_TEST_F( |
5108 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface); | 5108 LayerTreeHostTestSetMemoryPolicyOnLostOutputSurface); |
5109 | 5109 |
5110 } // namespace cc | 5110 } // namespace cc |
OLD | NEW |