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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3021 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { | 3021 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { |
3022 public: | 3022 public: |
3023 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 3023 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { |
3024 // PictureLayer can only be used with impl side painting enabled. | 3024 // PictureLayer can only be used with impl side painting enabled. |
3025 settings->impl_side_painting = true; | 3025 settings->impl_side_painting = true; |
3026 settings->solid_color_scrollbars = true; | 3026 settings->solid_color_scrollbars = true; |
3027 } | 3027 } |
3028 | 3028 |
3029 virtual void SetupTree() OVERRIDE { | 3029 virtual void SetupTree() OVERRIDE { |
3030 layer_ = FakePictureLayer::Create(&client_); | 3030 layer_ = FakePictureLayer::Create(&client_); |
3031 // Force commits to not be aborted so new frames get drawn, otherwise | |
3032 // the renderer gets deferred initialized but nothing new needs drawing. | |
3033 layer_->set_always_update_resources(true); | |
danakj
2013/07/23 15:35:27
Is this saying that when we switch to GL mode, the
enne (OOO)
2013/07/23 16:58:21
I am not convinced of that. If you switch modes b
danakj
2013/07/23 17:00:11
I guess it depends what it means to switch modes,
boliu
2013/07/23 17:19:44
Right. The reason there's a SetNeedsCommit is mail
| |
3031 layer_tree_host()->SetRootLayer(layer_); | 3034 layer_tree_host()->SetRootLayer(layer_); |
3032 LayerTreeHostTest::SetupTree(); | 3035 LayerTreeHostTest::SetupTree(); |
3033 } | 3036 } |
3034 | 3037 |
3035 virtual void BeginTest() OVERRIDE { | 3038 virtual void BeginTest() OVERRIDE { |
3036 did_initialize_gl_ = false; | 3039 did_initialize_gl_ = false; |
3037 did_release_gl_ = false; | 3040 did_release_gl_ = false; |
3038 PostSetNeedsCommitToMainThread(); | 3041 PostSetNeedsCommitToMainThread(); |
3039 } | 3042 } |
3040 | 3043 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3304 // Layers added to the tree get committed. | 3307 // Layers added to the tree get committed. |
3305 ++expected_push_properties_child_; | 3308 ++expected_push_properties_child_; |
3306 ++expected_push_properties_grandchild_; | 3309 ++expected_push_properties_grandchild_; |
3307 break; | 3310 break; |
3308 case 15: | 3311 case 15: |
3309 grandchild_->SetPosition(gfx::Point(1, 1)); | 3312 grandchild_->SetPosition(gfx::Point(1, 1)); |
3310 // The modified layer needs commit | 3313 // The modified layer needs commit |
3311 ++expected_push_properties_grandchild_; | 3314 ++expected_push_properties_grandchild_; |
3312 break; | 3315 break; |
3313 case 16: | 3316 case 16: |
3317 // SetNeedsDisplay does not always set needs commit (so call it | |
3318 // explicitly), but is a property change. | |
3314 child_->SetNeedsDisplay(); | 3319 child_->SetNeedsDisplay(); |
3315 // The modified layer needs commit | |
3316 ++expected_push_properties_child_; | 3320 ++expected_push_properties_child_; |
3321 layer_tree_host()->SetNeedsCommit(); | |
3317 break; | 3322 break; |
3318 case 17: | 3323 case 17: |
3319 EndTest(); | 3324 EndTest(); |
3320 break; | 3325 break; |
3321 } | 3326 } |
3322 | 3327 |
3323 // Content/Picture layers require PushProperties every commit that they are | 3328 // Content/Picture layers require PushProperties every commit that they are |
3324 // in the tree. | 3329 // in the tree. |
3325 if ((leaf_content_layer_.get() && leaf_content_layer_->layer_tree_host()) || | 3330 if ((leaf_content_layer_.get() && leaf_content_layer_->layer_tree_host()) || |
3326 (leaf_picture_layer_.get() && leaf_picture_layer_->layer_tree_host())) | 3331 (leaf_picture_layer_.get() && leaf_picture_layer_->layer_tree_host())) |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3881 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { | 3886 TEST_F(LayerTreeHostTestTreeActivationCallback, DirectRenderer) { |
3882 RunTest(true, false, true); | 3887 RunTest(true, false, true); |
3883 } | 3888 } |
3884 | 3889 |
3885 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { | 3890 TEST_F(LayerTreeHostTestTreeActivationCallback, DelegatingRenderer) { |
3886 RunTest(true, true, true); | 3891 RunTest(true, true, true); |
3887 } | 3892 } |
3888 | 3893 |
3889 } // namespace | 3894 } // namespace |
3890 } // namespace cc | 3895 } // namespace cc |
OLD | NEW |