Chromium Code Reviews| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 num_draws_++; | 78 num_draws_++; |
| 79 if (!impl->active_tree()->source_frame_number()) | 79 if (!impl->active_tree()->source_frame_number()) |
| 80 EndTest(); | 80 EndTest(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 83 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 84 num_commits_++; | 84 num_commits_++; |
| 85 } | 85 } |
| 86 | 86 |
| 87 virtual void AfterTest() OVERRIDE { | 87 virtual void AfterTest() OVERRIDE { |
| 88 EXPECT_GE(1, num_commits_); | 88 EXPECT_GE(num_commits_, 1); |
| 89 EXPECT_GE(1, num_draws_); | 89 EXPECT_GE(num_draws_, 1); |
| 90 } | 90 } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 int num_commits_; | 93 int num_commits_; |
| 94 int num_draws_; | 94 int num_draws_; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit1); | 97 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNeedsCommit1); |
| 98 | 98 |
| 99 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that | 99 // A SetNeedsCommit should lead to 1 commit. Issuing a second commit after that |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 enum Properties { | 147 enum Properties { |
| 148 STARTUP, | 148 STARTUP, |
| 149 BOUNDS, | 149 BOUNDS, |
| 150 HIDE_LAYER_AND_SUBTREE, | 150 HIDE_LAYER_AND_SUBTREE, |
| 151 DRAWS_CONTENT, | 151 DRAWS_CONTENT, |
| 152 DONE, | 152 DONE, |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 virtual void BeginTest() OVERRIDE { | 155 virtual void BeginTest() OVERRIDE { |
| 156 index_ = STARTUP; | 156 index_ = STARTUP; |
| 157 index_impl_ = STARTUP; | |
| 157 PostSetNeedsCommitToMainThread(); | 158 PostSetNeedsCommitToMainThread(); |
| 158 } | 159 } |
| 159 | 160 |
| 160 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 161 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 161 VerifyAfterValues(impl->active_tree()->root_layer()); | 162 VerifyAfterValues(impl->active_tree()->root_layer()); |
| 162 } | 163 } |
| 163 | 164 |
| 164 virtual void DidCommitAndDrawFrame() OVERRIDE { | 165 virtual void DidCommitAndDrawFrame() OVERRIDE { |
| 165 SetBeforeValues(layer_tree_host()->root_layer()); | 166 SetBeforeValues(layer_tree_host()->root_layer()); |
| 166 VerifyBeforeValues(layer_tree_host()->root_layer()); | 167 VerifyBeforeValues(layer_tree_host()->root_layer()); |
| 167 | 168 |
| 168 ++index_; | 169 ++index_; |
| 169 if (index_ == DONE) { | 170 if (index_ == DONE) |
| 170 EndTest(); | 171 EndTest(); |
| 171 return; | |
| 172 } | |
| 173 | 172 |
| 174 SetAfterValues(layer_tree_host()->root_layer()); | 173 SetAfterValues(layer_tree_host()->root_layer()); |
| 175 } | 174 } |
| 176 | 175 |
| 177 virtual void AfterTest() OVERRIDE {} | 176 virtual void AfterTest() OVERRIDE {} |
| 178 | 177 |
| 179 void VerifyBeforeValues(Layer* layer) { | 178 void VerifyBeforeValues(Layer* layer) { |
| 180 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); | 179 EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString()); |
| 181 EXPECT_FALSE(layer->hide_layer_and_subtree()); | 180 EXPECT_FALSE(layer->hide_layer_and_subtree()); |
| 182 EXPECT_FALSE(layer->DrawsContent()); | 181 EXPECT_FALSE(layer->DrawsContent()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 case HIDE_LAYER_AND_SUBTREE: | 215 case HIDE_LAYER_AND_SUBTREE: |
| 217 layer->SetHideLayerAndSubtree(true); | 216 layer->SetHideLayerAndSubtree(true); |
| 218 break; | 217 break; |
| 219 case DRAWS_CONTENT: | 218 case DRAWS_CONTENT: |
| 220 layer->SetIsDrawable(true); | 219 layer->SetIsDrawable(true); |
| 221 break; | 220 break; |
| 222 } | 221 } |
| 223 } | 222 } |
| 224 | 223 |
| 225 int index_; | 224 int index_; |
| 225 int index_impl_; | |
|
brianderson
2013/08/05 21:56:19
I need to revert my changes to this test.
| |
| 226 }; | 226 }; |
| 227 | 227 |
| 228 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 228 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
| 229 | 229 |
| 230 // 1 setNeedsRedraw after the first commit has completed should lead to 1 | 230 // 1 setNeedsRedraw after the first commit has completed should lead to 1 |
| 231 // additional draw. | 231 // additional draw. |
| 232 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { | 232 class LayerTreeHostTestSetNeedsRedraw : public LayerTreeHostTest { |
| 233 public: | 233 public: |
| 234 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} | 234 LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} |
| 235 | 235 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 614 | 614 |
| 615 // A compositeAndReadback while invisible should force a normal commit without | 615 // A compositeAndReadback while invisible should force a normal commit without |
| 616 // assertion. | 616 // assertion. |
| 617 class LayerTreeHostTestCompositeAndReadbackWhileInvisible | 617 class LayerTreeHostTestCompositeAndReadbackWhileInvisible |
| 618 : public LayerTreeHostTest { | 618 : public LayerTreeHostTest { |
| 619 public: | 619 public: |
| 620 LayerTreeHostTestCompositeAndReadbackWhileInvisible() : num_commits_(0) {} | 620 LayerTreeHostTestCompositeAndReadbackWhileInvisible() : num_commits_(0) {} |
| 621 | 621 |
| 622 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 622 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 623 | 623 |
| 624 virtual void DidCommitAndDrawFrame() OVERRIDE { | 624 virtual void DidCommit() OVERRIDE { |
| 625 num_commits_++; | 625 num_commits_++; |
| 626 if (num_commits_ == 1) { | 626 if (num_commits_ == 1) { |
| 627 layer_tree_host()->SetVisible(false); | 627 layer_tree_host()->SetVisible(false); |
| 628 layer_tree_host()->SetNeedsCommit(); | 628 layer_tree_host()->SetNeedsCommit(); |
| 629 layer_tree_host()->SetNeedsCommit(); | 629 layer_tree_host()->SetNeedsCommit(); |
| 630 char pixels[4]; | 630 char pixels[4]; |
| 631 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); | 631 layer_tree_host()->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); |
| 632 } else { | 632 } else { |
| 633 EndTest(); | 633 EndTest(); |
| 634 } | 634 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 693 }; | 693 }; |
| 694 | 694 |
| 695 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); | 695 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); |
| 696 | 696 |
| 697 // This test verifies that LayerTreeHostImpl's current frame time gets | 697 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 698 // updated in consecutive frames when it doesn't draw due to tree | 698 // updated in consecutive frames when it doesn't draw due to tree |
| 699 // activation failure. | 699 // activation failure. |
| 700 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails | 700 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails |
| 701 : public LayerTreeHostTest { | 701 : public LayerTreeHostTest { |
| 702 public: | 702 public: |
| 703 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() : frame_(0) {} | 703 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() |
| 704 : frame_count_with_pending_tree_(0) {} | |
| 704 | 705 |
| 705 virtual void BeginTest() OVERRIDE { | 706 virtual void BeginTest() OVERRIDE { |
| 706 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); | 707 layer_tree_host()->SetViewportSize(gfx::Size(20, 20)); |
| 707 layer_tree_host()->set_background_color(SK_ColorGRAY); | 708 layer_tree_host()->set_background_color(SK_ColorGRAY); |
| 708 | 709 |
| 709 PostSetNeedsCommitToMainThread(); | 710 PostSetNeedsCommitToMainThread(); |
| 710 } | 711 } |
| 711 | 712 |
| 713 virtual void WillBeginFrameOnThread(LayerTreeHostImpl* host_impl, | |
| 714 const BeginFrameArgs &args) OVERRIDE { | |
| 715 TRACE_EVENT0("cc", "WillBeginFrameOnThreadbca"); | |
| 716 if (host_impl->pending_tree()) | |
| 717 frame_count_with_pending_tree_++; | |
| 718 } | |
| 719 | |
| 712 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 720 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 713 if (frame_ >= 1) { | 721 if (frame_count_with_pending_tree_ > 1) { |
| 714 EXPECT_NE(first_frame_time_, impl->CurrentFrameTimeTicks()); | 722 EXPECT_NE(first_frame_time_.ToInternalValue(), |
| 723 impl->CurrentFrameTimeTicks().ToInternalValue()); | |
| 715 EndTest(); | 724 EndTest(); |
| 716 return; | 725 return; |
| 717 } | 726 } |
| 718 | 727 |
| 719 EXPECT_FALSE(impl->settings().impl_side_painting); | 728 EXPECT_FALSE(impl->settings().impl_side_painting); |
| 720 EndTest(); | 729 EndTest(); |
| 721 } | 730 } |
| 722 | 731 |
| 723 virtual bool CanActivatePendingTree(LayerTreeHostImpl* impl) OVERRIDE { | 732 virtual bool CanActivatePendingTree(LayerTreeHostImpl* impl) OVERRIDE { |
| 724 if (frame_ >= 1) | 733 return frame_count_with_pending_tree_ > 1; |
| 725 return true; | |
| 726 | |
| 727 return false; | |
| 728 } | 734 } |
| 729 | 735 |
| 730 virtual bool CanActivatePendingTreeIfNeeded(LayerTreeHostImpl* impl) | 736 virtual bool CanActivatePendingTreeIfNeeded(LayerTreeHostImpl* impl) |
| 731 OVERRIDE { | 737 OVERRIDE { |
| 732 frame_++; | 738 if (frame_count_with_pending_tree_ > 1) |
| 733 if (frame_ == 1) { | 739 return true; |
| 740 | |
| 741 if (first_frame_time_.is_null()) { | |
| 734 first_frame_time_ = impl->CurrentFrameTimeTicks(); | 742 first_frame_time_ = impl->CurrentFrameTimeTicks(); |
| 735 | 743 |
| 736 // Since base::TimeTicks::Now() uses a low-resolution clock on | 744 // Since base::TimeTicks::Now() uses a low-resolution clock on |
| 737 // Windows, we need to make sure that the clock has incremented past | 745 // Windows, we need to make sure that the clock has incremented past |
| 738 // first_frame_time_. | 746 // first_frame_time_. |
| 739 while (first_frame_time_ == base::TimeTicks::Now()) {} | 747 while (first_frame_time_ == base::TimeTicks::Now()) {} |
| 748 } | |
| 749 return false; | |
| 750 } | |
| 740 | 751 |
| 741 return false; | 752 virtual void DidActivateTreeOnThread(LayerTreeHostImpl *impl) OVERRIDE { |
| 742 } | 753 if (impl->settings().impl_side_painting) |
| 743 | 754 EXPECT_NE(frame_count_with_pending_tree_, 1); |
| 744 return true; | |
| 745 } | 755 } |
| 746 | 756 |
| 747 virtual void AfterTest() OVERRIDE {} | 757 virtual void AfterTest() OVERRIDE {} |
| 748 | 758 |
| 749 private: | 759 private: |
| 750 int frame_; | 760 int frame_count_with_pending_tree_; |
| 751 base::TimeTicks first_frame_time_; | 761 base::TimeTicks first_frame_time_; |
| 752 }; | 762 }; |
| 753 | 763 |
| 754 SINGLE_AND_MULTI_THREAD_TEST_F( | 764 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 755 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | 765 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); |
| 756 | 766 |
| 757 // This test verifies that LayerTreeHostImpl's current frame time gets | 767 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 758 // updated in consecutive frames when it draws in each frame. | 768 // updated in consecutive frames when it draws in each frame. |
| 759 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { | 769 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { |
| 760 public: | 770 public: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 817 scroll_layer_->SetScrollOffset(gfx::Vector2d()); | 827 scroll_layer_->SetScrollOffset(gfx::Vector2d()); |
| 818 layer_tree_host()->root_layer()->AddChild(scroll_layer_); | 828 layer_tree_host()->root_layer()->AddChild(scroll_layer_); |
| 819 } | 829 } |
| 820 | 830 |
| 821 virtual void BeginTest() OVERRIDE { | 831 virtual void BeginTest() OVERRIDE { |
| 822 PostSetNeedsCommitToMainThread(); | 832 PostSetNeedsCommitToMainThread(); |
| 823 } | 833 } |
| 824 | 834 |
| 825 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) | 835 virtual void ApplyScrollAndScale(gfx::Vector2d scroll_delta, float scale) |
| 826 OVERRIDE { | 836 OVERRIDE { |
| 837 TRACE_EVENT0("cc", "ApplyScrollAndScale9"); | |
| 827 gfx::Vector2d offset = scroll_layer_->scroll_offset(); | 838 gfx::Vector2d offset = scroll_layer_->scroll_offset(); |
| 828 scroll_layer_->SetScrollOffset(offset + scroll_delta); | 839 scroll_layer_->SetScrollOffset(offset + scroll_delta); |
| 829 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); | 840 layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f); |
| 830 } | 841 } |
| 831 | 842 |
| 832 virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 843 virtual void SwapBuffersOnThread(LayerTreeHostImpl *impl, bool result) |
| 833 impl->ProcessScrollDeltas(); | 844 OVERRIDE { |
| 834 // We get one commit before the first draw, and the animation doesn't happen | 845 // We get one commit before the first draw, and the animation doesn't happen |
| 835 // until the second draw. | 846 // until the second draw. |
| 836 switch (impl->active_tree()->source_frame_number()) { | 847 switch (impl->active_tree()->source_frame_number()) { |
| 837 case 0: | 848 case 0: |
| 838 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); | 849 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); |
| 839 // We'll start an animation when we get back to the main thread. | 850 // We'll start an animation when we get back to the main thread. |
| 840 break; | 851 break; |
| 841 case 1: | 852 case 1: |
| 842 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); | 853 EXPECT_EQ(1.f, impl->active_tree()->page_scale_factor()); |
| 843 PostSetNeedsRedrawToMainThread(); | |
| 844 break; | 854 break; |
| 845 case 2: | 855 case 2: |
| 856 case 3: | |
| 857 case 4: | |
|
brianderson
2013/08/05 21:56:19
I will remove case 3 and 4 here. They were an expe
| |
| 846 EXPECT_EQ(1.25f, impl->active_tree()->page_scale_factor()); | 858 EXPECT_EQ(1.25f, impl->active_tree()->page_scale_factor()); |
| 859 PostSetNeedsCommitToMainThread(); | |
| 860 break; | |
| 861 case 5: | |
| 847 EndTest(); | 862 EndTest(); |
| 848 break; | 863 break; |
| 849 default: | 864 default: |
| 850 NOTREACHED(); | 865 NOTREACHED(); |
| 851 } | 866 } |
| 852 } | 867 } |
| 853 | 868 |
| 854 virtual void DidCommitAndDrawFrame() OVERRIDE { | 869 virtual void DidCommit() OVERRIDE { |
| 855 switch (layer_tree_host()->source_frame_number()) { | 870 switch (layer_tree_host()->source_frame_number()) { |
| 856 case 1: | 871 case 1: |
| 857 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); | 872 layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f); |
| 858 layer_tree_host()->StartPageScaleAnimation( | 873 layer_tree_host()->StartPageScaleAnimation( |
| 859 gfx::Vector2d(), false, 1.25f, base::TimeDelta()); | 874 gfx::Vector2d(), false, 1.25f, base::TimeDelta()); |
| 860 break; | 875 break; |
| 861 } | 876 } |
| 862 } | 877 } |
| 863 | 878 |
| 864 virtual void AfterTest() OVERRIDE {} | 879 virtual void AfterTest() OVERRIDE {} |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1255 parent_->AddChild(child_); | 1270 parent_->AddChild(child_); |
| 1256 | 1271 |
| 1257 layer_tree_host()->SetRootLayer(parent_); | 1272 layer_tree_host()->SetRootLayer(parent_); |
| 1258 LayerTreeHostTest::SetupTree(); | 1273 LayerTreeHostTest::SetupTree(); |
| 1259 } | 1274 } |
| 1260 | 1275 |
| 1261 virtual void BeginTest() OVERRIDE { | 1276 virtual void BeginTest() OVERRIDE { |
| 1262 PostSetNeedsCommitToMainThread(); | 1277 PostSetNeedsCommitToMainThread(); |
| 1263 } | 1278 } |
| 1264 | 1279 |
| 1265 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1280 virtual void DidCommit() OVERRIDE { |
| 1266 switch (layer_tree_host()->source_frame_number()) { | 1281 switch (layer_tree_host()->source_frame_number()) { |
| 1267 case 1: | 1282 case 1: |
| 1268 parent_->SetNeedsDisplay(); | 1283 parent_->SetNeedsDisplay(); |
| 1269 child_->SetNeedsDisplay(); | 1284 child_->SetNeedsDisplay(); |
| 1270 break; | 1285 break; |
| 1271 case 2: | 1286 case 2: |
| 1272 // Damage part of layers. | 1287 // Damage part of layers. |
| 1273 parent_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); | 1288 parent_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); |
| 1274 child_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); | 1289 child_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f)); |
| 1275 break; | 1290 break; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1386 | 1401 |
| 1387 class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest { | 1402 class LayerTreeHostTestFinishAllRendering : public LayerTreeHostTest { |
| 1388 public: | 1403 public: |
| 1389 LayerTreeHostTestFinishAllRendering() : once_(false), draw_count_(0) {} | 1404 LayerTreeHostTestFinishAllRendering() : once_(false), draw_count_(0) {} |
| 1390 | 1405 |
| 1391 virtual void BeginTest() OVERRIDE { | 1406 virtual void BeginTest() OVERRIDE { |
| 1392 layer_tree_host()->SetNeedsRedraw(); | 1407 layer_tree_host()->SetNeedsRedraw(); |
| 1393 PostSetNeedsCommitToMainThread(); | 1408 PostSetNeedsCommitToMainThread(); |
| 1394 } | 1409 } |
| 1395 | 1410 |
| 1396 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1411 virtual void DidCommit() OVERRIDE { |
| 1397 if (once_) | 1412 if (once_) |
| 1398 return; | 1413 return; |
| 1399 once_ = true; | 1414 once_ = true; |
| 1400 layer_tree_host()->SetNeedsRedraw(); | 1415 layer_tree_host()->SetNeedsRedraw(); |
| 1401 layer_tree_host()->AcquireLayerTextures(); | 1416 layer_tree_host()->AcquireLayerTextures(); |
| 1402 { | 1417 { |
| 1403 base::AutoLock lock(lock_); | 1418 base::AutoLock lock(lock_); |
| 1404 draw_count_ = 0; | 1419 draw_count_ = 0; |
| 1405 } | 1420 } |
| 1406 layer_tree_host()->FinishAllRendering(); | 1421 layer_tree_host()->FinishAllRendering(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1474 surface_layer2_->SetReplicaLayer(replica_layer2_.get()); | 1489 surface_layer2_->SetReplicaLayer(replica_layer2_.get()); |
| 1475 | 1490 |
| 1476 layer_tree_host()->SetRootLayer(root_layer_); | 1491 layer_tree_host()->SetRootLayer(root_layer_); |
| 1477 LayerTreeHostTest::SetupTree(); | 1492 LayerTreeHostTest::SetupTree(); |
| 1478 } | 1493 } |
| 1479 | 1494 |
| 1480 virtual void BeginTest() OVERRIDE { | 1495 virtual void BeginTest() OVERRIDE { |
| 1481 PostSetNeedsCommitToMainThread(); | 1496 PostSetNeedsCommitToMainThread(); |
| 1482 } | 1497 } |
| 1483 | 1498 |
| 1499 virtual void DidActivateTreeOnThread(LayerTreeHostImpl *host_impl) OVERRIDE { | |
| 1500 // Reduce the memory limit to only fit the root layer and one render | |
| 1501 // surface. This prevents any contents drawing into surfaces | |
| 1502 // from being allocated. | |
| 1503 if (host_impl->active_tree()->source_frame_number() == 0) { | |
| 1504 host_impl->SetMemoryPolicy( | |
| 1505 ManagedMemoryPolicy(100 * 100 * 4 * 2), true); | |
| 1506 } | |
| 1507 } | |
| 1508 | |
| 1484 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 1509 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 1485 Renderer* renderer = host_impl->renderer(); | 1510 Renderer* renderer = host_impl->renderer(); |
| 1486 RenderPass::Id surface1_render_pass_id = host_impl->active_tree() | 1511 RenderPass::Id surface1_render_pass_id = host_impl->active_tree() |
| 1487 ->root_layer()->children()[0]->render_surface()->RenderPassId(); | 1512 ->root_layer()->children()[0]->render_surface()->RenderPassId(); |
| 1488 RenderPass::Id surface2_render_pass_id = | 1513 RenderPass::Id surface2_render_pass_id = |
| 1489 host_impl->active_tree()->root_layer()->children()[0]->children()[0] | 1514 host_impl->active_tree()->root_layer()->children()[0]->children()[0] |
| 1490 ->render_surface()->RenderPassId(); | 1515 ->render_surface()->RenderPassId(); |
| 1491 | 1516 |
| 1492 switch (host_impl->active_tree()->source_frame_number()) { | 1517 switch (host_impl->active_tree()->source_frame_number()) { |
| 1493 case 0: | 1518 case 0: |
| 1494 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( | 1519 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( |
| 1495 surface1_render_pass_id)); | 1520 surface1_render_pass_id)); |
| 1496 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( | 1521 EXPECT_TRUE(renderer->HaveCachedResourcesForRenderPassId( |
| 1497 surface2_render_pass_id)); | 1522 surface2_render_pass_id)); |
| 1498 | |
| 1499 // Reduce the memory limit to only fit the root layer and one render | |
| 1500 // surface. This prevents any contents drawing into surfaces | |
| 1501 // from being allocated. | |
| 1502 host_impl->SetMemoryPolicy( | |
| 1503 ManagedMemoryPolicy(100 * 100 * 4 * 2), true); | |
| 1504 break; | 1523 break; |
| 1505 case 1: | 1524 case 1: |
| 1506 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( | 1525 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( |
| 1507 surface1_render_pass_id)); | 1526 surface1_render_pass_id)); |
| 1508 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( | 1527 EXPECT_FALSE(renderer->HaveCachedResourcesForRenderPassId( |
| 1509 surface2_render_pass_id)); | 1528 surface2_render_pass_id)); |
| 1510 | |
| 1511 EndTest(); | 1529 EndTest(); |
| 1512 break; | 1530 break; |
| 1513 } | 1531 } |
| 1514 } | 1532 } |
| 1515 | 1533 |
| 1516 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1534 virtual void DidCommit() OVERRIDE { |
|
enne (OOO)
2013/08/05 19:37:43
I want to look through these test changes a little
brianderson
2013/08/05 21:56:19
DidCommitAndDrawFrame is definitely race prone whe
| |
| 1517 if (layer_tree_host()->source_frame_number() < 2) | 1535 if (layer_tree_host()->source_frame_number() < 2) |
| 1518 root_layer_->SetNeedsDisplay(); | 1536 root_layer_->SetNeedsDisplay(); |
| 1519 } | 1537 } |
| 1520 | 1538 |
| 1521 virtual void AfterTest() OVERRIDE { | 1539 virtual void AfterTest() OVERRIDE { |
| 1522 EXPECT_LE(2u, root_layer_->update_count()); | 1540 EXPECT_LE(2u, root_layer_->update_count()); |
| 1523 EXPECT_LE(2u, surface_layer1_->update_count()); | 1541 EXPECT_LE(2u, surface_layer1_->update_count()); |
| 1524 EXPECT_LE(2u, surface_layer2_->update_count()); | 1542 EXPECT_LE(2u, surface_layer2_->update_count()); |
| 1525 } | 1543 } |
| 1526 | 1544 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1812 content_layer_ = ContentLayer::Create(&client_); | 1830 content_layer_ = ContentLayer::Create(&client_); |
| 1813 content_layer_->SetBounds(gfx::Size(10, 10)); | 1831 content_layer_->SetBounds(gfx::Size(10, 10)); |
| 1814 content_layer_->SetPosition(gfx::PointF(0.f, 0.f)); | 1832 content_layer_->SetPosition(gfx::PointF(0.f, 0.f)); |
| 1815 content_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 1833 content_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
| 1816 content_layer_->SetIsDrawable(true); | 1834 content_layer_->SetIsDrawable(true); |
| 1817 layer_tree_host()->root_layer()->AddChild(content_layer_); | 1835 layer_tree_host()->root_layer()->AddChild(content_layer_); |
| 1818 | 1836 |
| 1819 PostSetNeedsCommitToMainThread(); | 1837 PostSetNeedsCommitToMainThread(); |
| 1820 } | 1838 } |
| 1821 | 1839 |
| 1822 virtual void DidCommitAndDrawFrame() OVERRIDE { | 1840 virtual void DidCommit() OVERRIDE { |
| 1823 if (num_draw_layers_ == 2) | 1841 if (num_draw_layers_ == 2) |
| 1824 return; | 1842 return; |
| 1825 content_layer_->SetNeedsDisplay(); | 1843 content_layer_->SetNeedsDisplay(); |
| 1826 } | 1844 } |
| 1827 | 1845 |
| 1828 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1846 virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 1829 if (num_draw_layers_ == 1) | 1847 if (num_draw_layers_ == 1) |
| 1830 num_commit_complete_++; | 1848 num_commit_complete_++; |
| 1831 } | 1849 } |
| 1832 | 1850 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2208 settings->begin_frame_scheduling_enabled = true; | 2226 settings->begin_frame_scheduling_enabled = true; |
| 2209 settings->using_synchronous_renderer_compositor = true; | 2227 settings->using_synchronous_renderer_compositor = true; |
| 2210 } | 2228 } |
| 2211 | 2229 |
| 2212 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 2230 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
| 2213 | 2231 |
| 2214 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 2232 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 2215 // The BeginFrame notification is turned off now but will get enabled | 2233 // The BeginFrame notification is turned off now but will get enabled |
| 2216 // once we return. End test while it's enabled. | 2234 // once we return. End test while it's enabled. |
| 2217 ImplThreadTaskRunner()->PostTask( | 2235 ImplThreadTaskRunner()->PostTask( |
| 2218 FROM_HERE, | 2236 FROM_HERE, base::Bind( |
| 2219 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, | 2237 &LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled::EndTest, |
| 2220 base::Unretained(this))); | 2238 base::Unretained(this))); |
| 2221 } | 2239 } |
| 2222 | 2240 |
| 2223 virtual void AfterTest() OVERRIDE {} | 2241 virtual void AfterTest() OVERRIDE {} |
| 2224 }; | 2242 }; |
| 2225 | 2243 |
| 2226 MULTI_THREAD_TEST_F( | 2244 MULTI_THREAD_TEST_F( |
| 2227 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); | 2245 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); |
| 2228 | 2246 |
| 2229 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation | 2247 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation |
| 2230 : public LayerTreeHostTest { | 2248 : public LayerTreeHostTest { |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2462 root->AddChild(child); | 2480 root->AddChild(child); |
| 2463 | 2481 |
| 2464 layer_tree_host()->SetRootLayer(root); | 2482 layer_tree_host()->SetRootLayer(root); |
| 2465 LayerTreeHostTest::SetupTree(); | 2483 LayerTreeHostTest::SetupTree(); |
| 2466 } | 2484 } |
| 2467 | 2485 |
| 2468 virtual void BeginTest() OVERRIDE { | 2486 virtual void BeginTest() OVERRIDE { |
| 2469 PostSetNeedsCommitToMainThread(); | 2487 PostSetNeedsCommitToMainThread(); |
| 2470 } | 2488 } |
| 2471 | 2489 |
| 2472 virtual void DidCommitAndDrawFrame() OVERRIDE { | 2490 virtual void DidCommit() OVERRIDE { |
| 2473 WaitForCallback(); | 2491 WaitForCallback(); |
| 2474 } | 2492 } |
| 2475 | 2493 |
| 2476 void WaitForCallback() { | 2494 void WaitForCallback() { |
| 2477 base::MessageLoop::current()->PostTask( | 2495 base::MessageLoop::current()->PostTask( |
| 2478 FROM_HERE, | 2496 FROM_HERE, |
| 2479 base::Bind( | 2497 base::Bind( |
| 2480 &LayerTreeHostTestAsyncReadback::NextStep, | 2498 &LayerTreeHostTestAsyncReadback::NextStep, |
| 2481 base::Unretained(this))); | 2499 base::Unretained(this))); |
| 2482 } | 2500 } |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3004 layer_tree_host()->SetNeedsRedraw(); | 3022 layer_tree_host()->SetNeedsRedraw(); |
| 3005 break; | 3023 break; |
| 3006 case 3: | 3024 case 3: |
| 3007 // CompositeAndReadback in Round 4, first commit. | 3025 // CompositeAndReadback in Round 4, first commit. |
| 3008 EXPECT_EQ(2, frame_); | 3026 EXPECT_EQ(2, frame_); |
| 3009 break; | 3027 break; |
| 3010 case 4: | 3028 case 4: |
| 3011 // Round 4 done. | 3029 // Round 4 done. |
| 3012 EXPECT_EQ(2, frame_); | 3030 EXPECT_EQ(2, frame_); |
| 3013 layer_tree_host()->SetNeedsCommit(); | 3031 layer_tree_host()->SetNeedsCommit(); |
| 3032 // We cant SetNeedsRedraw immediately because it will race the commit. | |
| 3033 break; | |
| 3034 case 5: | |
| 3035 EXPECT_EQ(2, frame_); | |
| 3014 layer_tree_host()->SetNeedsRedraw(); | 3036 layer_tree_host()->SetNeedsRedraw(); |
| 3015 break; | 3037 break; |
| 3016 } | 3038 } |
| 3017 } | 3039 } |
| 3018 | 3040 |
| 3019 virtual void DidCompleteSwapBuffers() OVERRIDE { | 3041 virtual void DidCompleteSwapBuffers() OVERRIDE { |
| 3020 int commit = layer_tree_host()->source_frame_number(); | 3042 int commit = layer_tree_host()->source_frame_number(); |
| 3021 ++frame_; | 3043 ++frame_; |
| 3022 char pixels[4] = {0}; | 3044 char pixels[4] = {0}; |
| 3023 switch (frame_) { | 3045 switch (frame_) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3318 root_->AddChild(child2_); | 3340 root_->AddChild(child2_); |
| 3319 child_->AddChild(grandchild_); | 3341 child_->AddChild(grandchild_); |
| 3320 child2_->AddChild(leaf_scrollbar_layer_); | 3342 child2_->AddChild(leaf_scrollbar_layer_); |
| 3321 | 3343 |
| 3322 other_root_ = PushPropertiesCountingLayer::Create(); | 3344 other_root_ = PushPropertiesCountingLayer::Create(); |
| 3323 | 3345 |
| 3324 // Don't set the root layer here. | 3346 // Don't set the root layer here. |
| 3325 LayerTreeHostTest::SetupTree(); | 3347 LayerTreeHostTest::SetupTree(); |
| 3326 } | 3348 } |
| 3327 | 3349 |
| 3328 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3350 virtual void DidCommit() OVERRIDE { |
| 3329 ++num_commits_; | 3351 ++num_commits_; |
| 3330 | 3352 |
| 3331 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()); | 3353 EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count()); |
| 3332 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()); | 3354 EXPECT_EQ(expected_push_properties_child_, child_->push_properties_count()); |
| 3333 EXPECT_EQ(expected_push_properties_grandchild_, | 3355 EXPECT_EQ(expected_push_properties_grandchild_, |
| 3334 grandchild_->push_properties_count()); | 3356 grandchild_->push_properties_count()); |
| 3335 EXPECT_EQ(expected_push_properties_child2_, | 3357 EXPECT_EQ(expected_push_properties_child2_, |
| 3336 child2_->push_properties_count()); | 3358 child2_->push_properties_count()); |
| 3337 EXPECT_EQ(expected_push_properties_other_root_, | 3359 EXPECT_EQ(expected_push_properties_other_root_, |
| 3338 other_root_->push_properties_count()); | 3360 other_root_->push_properties_count()); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3500 bool has_thumb = false; | 3522 bool has_thumb = false; |
| 3501 scrollbar_layer_ = | 3523 scrollbar_layer_ = |
| 3502 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, root_->id()); | 3524 FakeScrollbarLayer::Create(paint_scrollbar, has_thumb, root_->id()); |
| 3503 | 3525 |
| 3504 root_->AddChild(scrollbar_layer_); | 3526 root_->AddChild(scrollbar_layer_); |
| 3505 | 3527 |
| 3506 layer_tree_host()->SetRootLayer(root_); | 3528 layer_tree_host()->SetRootLayer(root_); |
| 3507 LayerTreeHostTest::SetupTree(); | 3529 LayerTreeHostTest::SetupTree(); |
| 3508 } | 3530 } |
| 3509 | 3531 |
| 3510 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3532 virtual void DidCommit() OVERRIDE { |
| 3511 switch (layer_tree_host()->source_frame_number()) { | 3533 switch (layer_tree_host()->source_frame_number()) { |
| 3512 case 0: | 3534 case 0: |
| 3513 break; | 3535 break; |
| 3514 case 1: { | 3536 case 1: { |
| 3515 // During update, the ignore_set_needs_commit_ bit is set to true to | 3537 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3516 // avoid causing a second commit to be scheduled. If a property change | 3538 // avoid causing a second commit to be scheduled. If a property change |
| 3517 // is made during this, however, it needs to be pushed in the upcoming | 3539 // is made during this, however, it needs to be pushed in the upcoming |
| 3518 // commit. | 3540 // commit. |
| 3519 scoped_ptr<base::AutoReset<bool> > ignore = | 3541 scoped_ptr<base::AutoReset<bool> > ignore = |
| 3520 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3542 scrollbar_layer_->IgnoreSetNeedsCommit(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3583 size_t expected_push_properties_root_; | 3605 size_t expected_push_properties_root_; |
| 3584 size_t expected_push_properties_child_; | 3606 size_t expected_push_properties_child_; |
| 3585 size_t expected_push_properties_grandchild1_; | 3607 size_t expected_push_properties_grandchild1_; |
| 3586 size_t expected_push_properties_grandchild2_; | 3608 size_t expected_push_properties_grandchild2_; |
| 3587 size_t expected_push_properties_grandchild3_; | 3609 size_t expected_push_properties_grandchild3_; |
| 3588 }; | 3610 }; |
| 3589 | 3611 |
| 3590 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3612 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
| 3591 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3613 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3592 protected: | 3614 protected: |
| 3593 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3615 virtual void DidCommit() OVERRIDE { |
| 3594 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3616 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3595 switch (last_source_frame_number) { | 3617 switch (last_source_frame_number) { |
| 3596 case 0: | 3618 case 0: |
| 3597 EXPECT_FALSE(root_->needs_push_properties()); | 3619 EXPECT_FALSE(root_->needs_push_properties()); |
| 3598 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3620 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
| 3599 EXPECT_FALSE(child_->needs_push_properties()); | 3621 EXPECT_FALSE(child_->needs_push_properties()); |
| 3600 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3622 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| 3601 EXPECT_FALSE(grandchild1_->needs_push_properties()); | 3623 EXPECT_FALSE(grandchild1_->needs_push_properties()); |
| 3602 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3624 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); |
| 3603 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3625 EXPECT_FALSE(grandchild2_->needs_push_properties()); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 3623 break; | 3645 break; |
| 3624 } | 3646 } |
| 3625 } | 3647 } |
| 3626 }; | 3648 }; |
| 3627 | 3649 |
| 3628 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3650 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
| 3629 | 3651 |
| 3630 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3652 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
| 3631 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3653 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3632 protected: | 3654 protected: |
| 3633 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3655 virtual void DidCommit() OVERRIDE { |
| 3634 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3656 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3635 switch (last_source_frame_number) { | 3657 switch (last_source_frame_number) { |
| 3636 case 0: | 3658 case 0: |
| 3637 layer_tree_host()->SetRootLayer(root_); | 3659 layer_tree_host()->SetRootLayer(root_); |
| 3638 break; | 3660 break; |
| 3639 case 1: | 3661 case 1: |
| 3640 EXPECT_FALSE(root_->needs_push_properties()); | 3662 EXPECT_FALSE(root_->needs_push_properties()); |
| 3641 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3663 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
| 3642 EXPECT_FALSE(child_->needs_push_properties()); | 3664 EXPECT_FALSE(child_->needs_push_properties()); |
| 3643 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3665 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3706 break; | 3728 break; |
| 3707 } | 3729 } |
| 3708 } | 3730 } |
| 3709 }; | 3731 }; |
| 3710 | 3732 |
| 3711 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3733 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
| 3712 | 3734 |
| 3713 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3735 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
| 3714 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3736 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3715 protected: | 3737 protected: |
| 3716 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3738 virtual void DidCommit() OVERRIDE { |
| 3717 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3739 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3718 switch (last_source_frame_number) { | 3740 switch (last_source_frame_number) { |
| 3719 case 0: | 3741 case 0: |
| 3720 layer_tree_host()->SetRootLayer(root_); | 3742 layer_tree_host()->SetRootLayer(root_); |
| 3721 grandchild1_->set_persist_needs_push_properties(true); | 3743 grandchild1_->set_persist_needs_push_properties(true); |
| 3722 grandchild2_->set_persist_needs_push_properties(true); | 3744 grandchild2_->set_persist_needs_push_properties(true); |
| 3723 break; | 3745 break; |
| 3724 case 1: | 3746 case 1: |
| 3725 EXPECT_FALSE(root_->needs_push_properties()); | 3747 EXPECT_FALSE(root_->needs_push_properties()); |
| 3726 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3748 EXPECT_TRUE(root_->descendant_needs_push_properties()); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 3754 } | 3776 } |
| 3755 } | 3777 } |
| 3756 }; | 3778 }; |
| 3757 | 3779 |
| 3758 MULTI_THREAD_TEST_F( | 3780 MULTI_THREAD_TEST_F( |
| 3759 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3781 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
| 3760 | 3782 |
| 3761 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3783 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
| 3762 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3784 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3763 protected: | 3785 protected: |
| 3764 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3786 virtual void DidCommit() OVERRIDE { |
| 3765 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3787 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3766 switch (last_source_frame_number) { | 3788 switch (last_source_frame_number) { |
| 3767 case 0: | 3789 case 0: |
| 3768 layer_tree_host()->SetRootLayer(root_); | 3790 layer_tree_host()->SetRootLayer(root_); |
| 3769 break; | 3791 break; |
| 3770 case 1: | 3792 case 1: |
| 3771 EXPECT_FALSE(root_->needs_push_properties()); | 3793 EXPECT_FALSE(root_->needs_push_properties()); |
| 3772 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3794 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
| 3773 EXPECT_FALSE(child_->needs_push_properties()); | 3795 EXPECT_FALSE(child_->needs_push_properties()); |
| 3774 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3796 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3822 } | 3844 } |
| 3823 } | 3845 } |
| 3824 }; | 3846 }; |
| 3825 | 3847 |
| 3826 MULTI_THREAD_TEST_F( | 3848 MULTI_THREAD_TEST_F( |
| 3827 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3849 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
| 3828 | 3850 |
| 3829 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3851 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
| 3830 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3852 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3831 protected: | 3853 protected: |
| 3832 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3854 virtual void DidCommit() OVERRIDE { |
| 3833 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3855 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3834 switch (last_source_frame_number) { | 3856 switch (last_source_frame_number) { |
| 3835 case 0: | 3857 case 0: |
| 3836 layer_tree_host()->SetRootLayer(root_); | 3858 layer_tree_host()->SetRootLayer(root_); |
| 3837 break; | 3859 break; |
| 3838 case 1: | 3860 case 1: |
| 3839 EXPECT_FALSE(root_->needs_push_properties()); | 3861 EXPECT_FALSE(root_->needs_push_properties()); |
| 3840 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3862 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
| 3841 EXPECT_FALSE(child_->needs_push_properties()); | 3863 EXPECT_FALSE(child_->needs_push_properties()); |
| 3842 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3864 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3886 } | 3908 } |
| 3887 } | 3909 } |
| 3888 }; | 3910 }; |
| 3889 | 3911 |
| 3890 MULTI_THREAD_TEST_F( | 3912 MULTI_THREAD_TEST_F( |
| 3891 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 3913 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
| 3892 | 3914 |
| 3893 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 3915 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
| 3894 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3916 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3895 protected: | 3917 protected: |
| 3896 virtual void DidCommitAndDrawFrame() OVERRIDE { | 3918 virtual void DidCommit() OVERRIDE { |
| 3897 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3919 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3898 switch (last_source_frame_number) { | 3920 switch (last_source_frame_number) { |
| 3899 case 0: | 3921 case 0: |
| 3900 layer_tree_host()->SetRootLayer(root_); | 3922 layer_tree_host()->SetRootLayer(root_); |
| 3901 break; | 3923 break; |
| 3902 case 1: | 3924 case 1: |
| 3903 EXPECT_FALSE(root_->needs_push_properties()); | 3925 EXPECT_FALSE(root_->needs_push_properties()); |
| 3904 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3926 EXPECT_FALSE(root_->descendant_needs_push_properties()); |
| 3905 EXPECT_FALSE(child_->needs_push_properties()); | 3927 EXPECT_FALSE(child_->needs_push_properties()); |
| 3906 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3928 EXPECT_FALSE(child_->descendant_needs_push_properties()); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4068 FakeVideoFrameProvider provider_; | 4090 FakeVideoFrameProvider provider_; |
| 4069 scoped_refptr<VideoLayer> video_layer_; | 4091 scoped_refptr<VideoLayer> video_layer_; |
| 4070 int num_commits_; | 4092 int num_commits_; |
| 4071 int num_draws_; | 4093 int num_draws_; |
| 4072 }; | 4094 }; |
| 4073 | 4095 |
| 4074 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); | 4096 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); |
| 4075 | 4097 |
| 4076 } // namespace | 4098 } // namespace |
| 4077 } // namespace cc | 4099 } // namespace cc |
| OLD | NEW |