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

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

Issue 19106007: cc: Allow the main thread to cancel commits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address danakj's review comments Created 7 years, 5 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 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 virtual void BeginTest() OVERRIDE { 1810 virtual void BeginTest() OVERRIDE {
1811 layer_tree_host()->SetViewportSize(gfx::Size(10, 10)); 1811 layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
1812 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10)); 1812 layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10));
1813 1813
1814 PostSetNeedsCommitToMainThread(); 1814 PostSetNeedsCommitToMainThread();
1815 } 1815 }
1816 1816
1817 virtual void DidCommit() OVERRIDE { 1817 virtual void DidCommit() OVERRIDE {
1818 if (num_draw_layers_ == 2) 1818 if (num_draw_layers_ == 2)
1819 return; 1819 return;
1820 layer_tree_host()->root_layer()->SetNeedsDisplay(); 1820 layer_tree_host()->SetNeedsCommit();
1821 } 1821 }
1822 1822
1823 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1823 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1824 if (num_draw_layers_ == 1) 1824 if (num_draw_layers_ == 1)
1825 num_commit_complete_++; 1825 num_commit_complete_++;
1826 } 1826 }
1827 1827
1828 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { 1828 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
1829 num_draw_layers_++; 1829 num_draw_layers_++;
1830 if (num_draw_layers_ == 2) 1830 if (num_draw_layers_ == 2)
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest { 3095 class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
3096 public: 3096 public:
3097 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { 3097 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
3098 // PictureLayer can only be used with impl side painting enabled. 3098 // PictureLayer can only be used with impl side painting enabled.
3099 settings->impl_side_painting = true; 3099 settings->impl_side_painting = true;
3100 settings->solid_color_scrollbars = true; 3100 settings->solid_color_scrollbars = true;
3101 } 3101 }
3102 3102
3103 virtual void SetupTree() OVERRIDE { 3103 virtual void SetupTree() OVERRIDE {
3104 layer_ = FakePictureLayer::Create(&client_); 3104 layer_ = FakePictureLayer::Create(&client_);
3105 layer_->set_always_update_resources(true);
danakj 2013/07/18 21:57:23 Does this mean that if we enable deferred GL, we d
enne (OOO) 2013/07/19 01:23:51 To fix this case, I'll add a needs_redraw_after_co
3105 layer_tree_host()->SetRootLayer(layer_); 3106 layer_tree_host()->SetRootLayer(layer_);
3106 LayerTreeHostTest::SetupTree(); 3107 LayerTreeHostTest::SetupTree();
3107 } 3108 }
3108 3109
3109 virtual void BeginTest() OVERRIDE { 3110 virtual void BeginTest() OVERRIDE {
3110 did_initialize_gl_ = false; 3111 did_initialize_gl_ = false;
3111 did_release_gl_ = false; 3112 did_release_gl_ = false;
3112 PostSetNeedsCommitToMainThread(); 3113 PostSetNeedsCommitToMainThread();
3113 } 3114 }
3114 3115
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3378 // Layers added to the tree get committed. 3379 // Layers added to the tree get committed.
3379 ++expected_push_properties_child_; 3380 ++expected_push_properties_child_;
3380 ++expected_push_properties_grandchild_; 3381 ++expected_push_properties_grandchild_;
3381 break; 3382 break;
3382 case 15: 3383 case 15:
3383 grandchild_->SetPosition(gfx::Point(1, 1)); 3384 grandchild_->SetPosition(gfx::Point(1, 1));
3384 // The modified layer needs commit 3385 // The modified layer needs commit
3385 ++expected_push_properties_grandchild_; 3386 ++expected_push_properties_grandchild_;
3386 break; 3387 break;
3387 case 16: 3388 case 16:
3389 // SetNeedsDisplay does not always set needs commit (so call it
3390 // explicitly), but is a property change.
3388 child_->SetNeedsDisplay(); 3391 child_->SetNeedsDisplay();
3389 // The modified layer needs commit
3390 ++expected_push_properties_child_; 3392 ++expected_push_properties_child_;
3393 layer_tree_host()->SetNeedsCommit();
3391 break; 3394 break;
3392 case 17: 3395 case 17:
3393 EndTest(); 3396 EndTest();
3394 break; 3397 break;
3395 } 3398 }
3396 3399
3397 // Content/Picture layers require PushProperties every commit that they are 3400 // Content/Picture layers require PushProperties every commit that they are
3398 // in the tree. 3401 // in the tree.
3399 if ((leaf_content_layer_.get() && leaf_content_layer_->layer_tree_host()) || 3402 if ((leaf_content_layer_.get() && leaf_content_layer_->layer_tree_host()) ||
3400 (leaf_picture_layer_.get() && leaf_picture_layer_->layer_tree_host())) 3403 (leaf_picture_layer_.get() && leaf_picture_layer_->layer_tree_host()))
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 break; 3889 break;
3887 } 3890 }
3888 } 3891 }
3889 }; 3892 };
3890 3893
3891 MULTI_THREAD_TEST_F( 3894 MULTI_THREAD_TEST_F(
3892 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); 3895 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent);
3893 3896
3894 } // namespace 3897 } // namespace
3895 } // namespace cc 3898 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698