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 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 virtual void BeginTest() OVERRIDE { | 1805 virtual void BeginTest() OVERRIDE { |
1806 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); | 1806 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); |
1807 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); | 1807 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); |
1808 | 1808 |
1809 PostSetNeedsCommitToMainThread(); | 1809 PostSetNeedsCommitToMainThread(); |
1810 } | 1810 } |
1811 | 1811 |
1812 virtual void DidCommit() OVERRIDE { | 1812 virtual void DidCommit() OVERRIDE { |
1813 if (num_draw_layers_ == 2) | 1813 if (num_draw_layers_ == 2) |
1814 return; | 1814 return; |
1815 layer_tree_host()->root_layer()->SetNeedsDisplay(); | 1815 layer_tree_host()->SetNeedsCommit(); |
1816 } | 1816 } |
1817 | 1817 |
1818 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1818 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
1819 if (num_draw_layers_ == 1) | 1819 if (num_draw_layers_ == 1) |
1820 num_commit_complete_++; | 1820 num_commit_complete_++; |
1821 } | 1821 } |
1822 | 1822 |
1823 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1823 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
1824 num_draw_layers_++; | 1824 num_draw_layers_++; |
1825 if (num_draw_layers_ == 2) | 1825 if (num_draw_layers_ == 2) |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { | 3092 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { |
3093 public: | 3093 public: |
3094 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 3094 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
3095 // PictureLayer can only be used with impl side painting enabled. | 3095 // PictureLayer can only be used with impl side painting enabled. |
3096 settings->impl_side_painting = true; | 3096 settings->impl_side_painting = true; |
3097 settings->solid_color_scrollbars = true; | 3097 settings->solid_color_scrollbars = true; |
3098 } | 3098 } |
3099 | 3099 |
3100 virtual void SetupTree() OVERRIDE { | 3100 virtual void SetupTree() OVERRIDE { |
3101 layer_ = FakePictureLayer::Create(&client_); | 3101 layer_ = FakePictureLayer::Create(&client_); |
| 3102 // Force commits to not be aborted so new frames get drawn, otherwise |
| 3103 // the renderer gets deferred initialized but nothing new needs drawing. |
| 3104 layer_->set_always_update_resources(true); |
3102 layer_tree_host()->SetRootLayer(layer_); | 3105 layer_tree_host()->SetRootLayer(layer_); |
3103 LayerTreeHostTest::SetupTree(); | 3106 LayerTreeHostTest::SetupTree(); |
3104 } | 3107 } |
3105 | 3108 |
3106 virtual void BeginTest() OVERRIDE { | 3109 virtual void BeginTest() OVERRIDE { |
3107 did_initialize_gl_ = false; | 3110 did_initialize_gl_ = false; |
3108 did_release_gl_ = false; | 3111 did_release_gl_ = false; |
3109 last_source_frame_number_drawn_ = -1; // Never drawn. | 3112 last_source_frame_number_drawn_ = -1; // Never drawn. |
3110 PostSetNeedsCommitToMainThread(); | 3113 PostSetNeedsCommitToMainThread(); |
3111 } | 3114 } |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3388 // Layers added to the tree get committed. | 3391 // Layers added to the tree get committed. |
3389 ++expected_push_properties_child_; | 3392 ++expected_push_properties_child_; |
3390 ++expected_push_properties_grandchild_; | 3393 ++expected_push_properties_grandchild_; |
3391 break; | 3394 break; |
3392 case 15: | 3395 case 15: |
3393 grandchild_->SetPosition(gfx::Point(1, 1)); | 3396 grandchild_->SetPosition(gfx::Point(1, 1)); |
3394 // The modified layer needs commit | 3397 // The modified layer needs commit |
3395 ++expected_push_properties_grandchild_; | 3398 ++expected_push_properties_grandchild_; |
3396 break; | 3399 break; |
3397 case 16: | 3400 case 16: |
| 3401 // SetNeedsDisplay does not always set needs commit (so call it |
| 3402 // explicitly), but is a property change. |
3398 child_->SetNeedsDisplay(); | 3403 child_->SetNeedsDisplay(); |
3399 // The modified layer needs commit | |
3400 ++expected_push_properties_child_; | 3404 ++expected_push_properties_child_; |
| 3405 layer_tree_host()->SetNeedsCommit(); |
3401 break; | 3406 break; |
3402 case 17: | 3407 case 17: |
3403 EndTest(); | 3408 EndTest(); |
3404 break; | 3409 break; |
3405 } | 3410 } |
3406 | 3411 |
3407 // Content/Picture layers require PushProperties every commit that they are | 3412 // Content/Picture layers require PushProperties every commit that they are |
3408 // in the tree. | 3413 // in the tree. |
3409 if ((leaf_content_layer_.get() && leaf_content_layer_->layer_tree_host()) || | 3414 if ((leaf_content_layer_.get() && leaf_content_layer_->layer_tree_host()) || |
3410 (leaf_picture_layer_.get() && leaf_picture_layer_->layer_tree_host())) | 3415 (leaf_picture_layer_.get() && leaf_picture_layer_->layer_tree_host())) |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3965 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { | 3970 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { |
3966 RunTest(true, false, true); | 3971 RunTest(true, false, true); |
3967 } | 3972 } |
3968 | 3973 |
3969 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { | 3974 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { |
3970 RunTest(true, true, true); | 3975 RunTest(true, true, true); |
3971 } | 3976 } |
3972 | 3977 |
3973 } // namespace | 3978 } // namespace |
3974 } // namespace cc | 3979 } // namespace cc |
OLD | NEW |