diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-12 01:43:06 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-12 01:44:17 +0000 |
commit | 174c6d466c98f31a8f1017241499a23038297f38 (patch) | |
tree | 9c37260847c0bee1b94a462038ff7dc065324593 /ui/views | |
parent | f83ef232a24922c700fe63357ccddcb700a01c27 (diff) | |
download | chromium_src-174c6d466c98f31a8f1017241499a23038297f38.zip chromium_src-174c6d466c98f31a8f1017241499a23038297f38.tar.gz chromium_src-174c6d466c98f31a8f1017241499a23038297f38.tar.bz2 |
Make SingleThreadProxy a SchedulerClient
This makes ui::Compositor no longer in charge of
scheduling commits and draws, deferring it to cc::Scheduler.
Other compositors that use SingleThreadProxy are left calling composite
synchronously and now pass a flag to indicate that this is their
intention. This patch doesn't remove synchronous composite, but now
makes it mutually exclusive with scheduling.
BUG=329552, 287250
Review URL: https://codereview.chromium.org/134623005
Cr-Commit-Position: refs/heads/master@{#288866}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288866 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/view_unittest.cc | 60 |
1 files changed, 40 insertions, 20 deletions
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index c4e6dcb..87164b0 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc @@ -3087,20 +3087,23 @@ TEST_F(ViewLayerTest, DontPaintChildrenWithLayers) { widget()->SetContentsView(content_view); content_view->SetPaintToLayer(true); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); GetRootLayer()->SchedulePaint(gfx::Rect(0, 0, 10, 10)); content_view->set_painted(false); // content_view no longer has a dirty rect. Paint from the root and make sure // PaintTrackingView isn't painted. GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_FALSE(content_view->painted()); // Make content_view have a dirty rect, paint the layers and make sure // PaintTrackingView is painted. content_view->layer()->SchedulePaint(gfx::Rect(0, 0, 10, 10)); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_TRUE(content_view->painted()); } @@ -3340,13 +3343,15 @@ TEST_F(ViewLayerTest, BoundsTreePaintUpdatesCullSet) { // Schedule a full-view paint to get everyone's rectangles updated. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Now we have test_view - v1 - v2. Damage to only test_view should only // return root_view and test_view. test_view->SchedulePaintInRect(gfx::Rect(0, 0, 1, 1)); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_EQ(2U, test_view->last_cull_set_.size()); EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView())); EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view)); @@ -3354,7 +3359,8 @@ TEST_F(ViewLayerTest, BoundsTreePaintUpdatesCullSet) { // Damage to v1 only should only return root_view, test_view, and v1. test_view->SchedulePaintInRect(gfx::Rect(11, 16, 1, 1)); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_EQ(3U, test_view->last_cull_set_.size()); EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView())); EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view)); @@ -3364,7 +3370,8 @@ TEST_F(ViewLayerTest, BoundsTreePaintUpdatesCullSet) { // on call to TestView::Paint(), along with the widget root view. test_view->SchedulePaintInRect(gfx::Rect(31, 49, 1, 1)); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_EQ(4U, test_view->last_cull_set_.size()); EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView())); EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view)); @@ -3391,13 +3398,15 @@ TEST_F(ViewLayerTest, BoundsTreeWithRTL) { // Schedule a full-view paint to get everyone's rectangles updated. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Damage to the right side of the parent view should touch both child views. gfx::Rect rtl_damage(test_view->bounds().width() - 16, 18, 1, 1); test_view->SchedulePaintInRect(rtl_damage); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_EQ(4U, test_view->last_cull_set_.size()); EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView())); EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view)); @@ -3409,7 +3418,8 @@ TEST_F(ViewLayerTest, BoundsTreeWithRTL) { gfx::Rect ltr_damage(16, 18, 1, 1); test_view->SchedulePaintInRect(ltr_damage); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_EQ(2U, test_view->last_cull_set_.size()); EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView())); EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view)); @@ -3433,18 +3443,21 @@ TEST_F(ViewLayerTest, BoundsTreeSetBoundsChangesCullSet) { // Schedule a full-view paint to get everyone's rectangles updated. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Move v1 to a new origin out of the way of our next query. v1->SetBoundsRect(gfx::Rect(50, 60, 100, 101)); // The move will force a repaint. GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Schedule a paint with damage rect where v1 used to be. test_view->SchedulePaintInRect(gfx::Rect(5, 6, 10, 11)); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Should only have picked up root_view and test_view. EXPECT_EQ(2U, test_view->last_cull_set_.size()); @@ -3467,7 +3480,8 @@ TEST_F(ViewLayerTest, BoundsTreeLayerChangeMakesNewTree) { // Schedule a full-view paint to get everyone's rectangles updated. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Set v1 to paint to its own layer, it should remove itself from the // test_view heiarchy and no longer intersect with damage rects in that cull @@ -3477,7 +3491,8 @@ TEST_F(ViewLayerTest, BoundsTreeLayerChangeMakesNewTree) { // Schedule another full-view paint. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // v1 and v2 should no longer be present in the test_view cull_set. EXPECT_EQ(2U, test_view->last_cull_set_.size()); EXPECT_EQ(0U, test_view->last_cull_set_.count(v1)); @@ -3488,7 +3503,8 @@ TEST_F(ViewLayerTest, BoundsTreeLayerChangeMakesNewTree) { // Schedule another full-view paint. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // We should be back to the full cull set including v1 and v2. EXPECT_EQ(4U, test_view->last_cull_set_.size()); EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView())); @@ -3512,7 +3528,8 @@ TEST_F(ViewLayerTest, BoundsTreeRemoveChildRemovesBounds) { // Schedule a full-view paint to get everyone's rectangles updated. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Now remove v1 from the root view. test_view->RemoveChildView(v1); @@ -3520,7 +3537,8 @@ TEST_F(ViewLayerTest, BoundsTreeRemoveChildRemovesBounds) { // Schedule another full-view paint. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // v1 and v2 should no longer be present in the test_view cull_set. EXPECT_EQ(2U, test_view->last_cull_set_.size()); EXPECT_EQ(0U, test_view->last_cull_set_.count(v1)); @@ -3551,7 +3569,8 @@ TEST_F(ViewLayerTest, BoundsTreeMoveViewMovesBounds) { // Schedule a full-view paint and ensure all views are present in the cull. test_view->SchedulePaintInRect(test_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); EXPECT_EQ(5U, test_view->last_cull_set_.size()); EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView())); EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view)); @@ -3574,7 +3593,8 @@ TEST_F(ViewLayerTest, BoundsTreeMoveViewMovesBounds) { test_view->SchedulePaintInRect(test_view->bounds()); widget_view->SchedulePaintInRect(widget_view->bounds()); GetRootLayer()->GetCompositor()->ScheduleDraw(); - ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor()); + ui::DrawWaiterForTest::WaitForCompositingEnded( + GetRootLayer()->GetCompositor()); // Only v1 should be present in the first cull set. EXPECT_EQ(3U, test_view->last_cull_set_.size()); |