OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 | 681 |
682 virtual void AfterTest() OVERRIDE { | 682 virtual void AfterTest() OVERRIDE { |
683 EXPECT_EQ(3, did_swaps_); | 683 EXPECT_EQ(3, did_swaps_); |
684 } | 684 } |
685 | 685 |
686 int did_swaps_; | 686 int did_swaps_; |
687 }; | 687 }; |
688 | 688 |
689 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); | 689 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); |
690 | 690 |
691 class LayerTreeHostDamageTestVisibleTilesStillTriggerDraws | |
692 : public LayerTreeHostDamageTest { | |
693 | |
694 virtual void BeginTest() OVERRIDE { | |
695 if (!settings_.impl_side_painting) { | |
brianderson
2013/09/07 00:50:37
Is there a macro that does not instantiate the Mai
epenner
2013/09/07 00:57:15
Doesn't look like it, and the code to do it is rat
danakj
2013/09/07 00:59:05
Just override InitializeSettings and turn impl pai
epenner
2013/09/07 01:52:23
That seemed less intuitive if it fails. But not ve
| |
696 EndTest(); | |
697 return; | |
698 } | |
699 PostSetNeedsCommitToMainThread(); | |
700 } | |
701 | |
702 virtual void SetupTree() OVERRIDE { | |
703 root_ = FakeContentLayer::Create(&client_); | |
704 root_->SetBounds(gfx::Size(500, 500)); | |
705 layer_tree_host()->SetRootLayer(root_); | |
706 LayerTreeHostDamageTest::SetupTree(); | |
707 | |
708 swap_count_ = 0; | |
709 prepare_to_draw_count_ = 0; | |
710 update_visible_tile_count_ = 0; | |
711 } | |
712 | |
713 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | |
714 LayerTreeHostImpl::FrameData* frame_data, | |
715 bool result) OVERRIDE { | |
716 EXPECT_TRUE(result); | |
717 prepare_to_draw_count_++; | |
718 switch (prepare_to_draw_count_) { | |
719 case 1: | |
720 // Detect that we have an incomplete tile, during the first frame. | |
721 // The first frame should have damage. | |
722 frame_data->contains_incomplete_tile = true; | |
723 DCHECK(!frame_data->has_no_damage); | |
724 break; | |
725 case 2: | |
726 // Make a no-damage frame. We early out and can't detect | |
727 // incomplete tiles, even if they still exist. | |
728 frame_data->contains_incomplete_tile = false; | |
729 frame_data->has_no_damage = true; | |
730 break; | |
731 case 3: | |
732 // Trigger the last swap for the completed tile. | |
733 frame_data->contains_incomplete_tile = false; | |
734 frame_data->has_no_damage = false; | |
735 EndTest(); | |
736 case 4: | |
737 case 5: | |
738 case 6: | |
739 break; | |
brianderson
2013/09/07 00:50:37
Are cases 4-6 needed?
epenner
2013/09/07 00:57:15
Oops. Removed those. Done.
| |
740 default: | |
741 NOTREACHED(); | |
742 break; | |
743 } | |
744 | |
745 return result; | |
746 } | |
747 | |
748 virtual void UpdateVisibleTilesOnThread( | |
749 LayerTreeHostImpl* host_impl) OVERRIDE { | |
750 // Simulate creating some visible tiles (that trigger prepare-to-draws). | |
751 // The first we make into a no-damage-frame during prepare-to-draw (see | |
752 // above). This is to insure we still get UpdateVisibleTiles calls after | |
brianderson
2013/09/07 00:50:37
nit: ensure
epenner
2013/09/07 00:57:15
Done.
| |
753 // a no-damage or aborted frame. | |
754 update_visible_tile_count_++; | |
755 switch (update_visible_tile_count_) { | |
756 case 3: | |
757 case 6: | |
758 host_impl->DidInitializeVisibleTile(); | |
759 break; | |
760 case 7: | |
761 NOTREACHED(); | |
762 break; | |
763 } | |
764 } | |
765 | |
766 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | |
767 bool didSwap) OVERRIDE { | |
768 if (!didSwap) | |
769 return; | |
770 ++swap_count_; | |
771 } | |
772 | |
773 virtual void AfterTest() OVERRIDE { | |
774 if (!settings_.impl_side_painting) | |
775 return; | |
776 EXPECT_EQ(update_visible_tile_count_, 6); | |
777 EXPECT_EQ(prepare_to_draw_count_, 3); | |
778 EXPECT_EQ(swap_count_, 2); | |
779 } | |
780 | |
781 FakeContentLayerClient client_; | |
782 scoped_refptr<FakeContentLayer> root_; | |
783 int swap_count_; | |
784 int prepare_to_draw_count_; | |
785 int update_visible_tile_count_; | |
786 }; | |
787 | |
788 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestVisibleTilesStillTriggerDraws); | |
789 | |
691 } // namespace | 790 } // namespace |
692 } // namespace cc | 791 } // namespace cc |
OLD | NEW |