| 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/location.h" | 10 #include "base/location.h" |
| (...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 impl_for_evict_textures_->EvictTexturesForTesting(); | 1708 impl_for_evict_textures_->EvictTexturesForTesting(); |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 // Commit 1: Just commit and draw normally, then post an eviction at the end | 1711 // Commit 1: Just commit and draw normally, then post an eviction at the end |
| 1712 // that will trigger a commit. | 1712 // that will trigger a commit. |
| 1713 // Commit 2: Triggered by the eviction, let it go through and then set | 1713 // Commit 2: Triggered by the eviction, let it go through and then set |
| 1714 // needsCommit. | 1714 // needsCommit. |
| 1715 // Commit 3: Triggered by the setNeedsCommit. In Layout(), post an eviction | 1715 // Commit 3: Triggered by the setNeedsCommit. In Layout(), post an eviction |
| 1716 // task, which will be handled before the commit. Don't set needsCommit, it | 1716 // task, which will be handled before the commit. Don't set needsCommit, it |
| 1717 // should have been posted. A frame should not be drawn (note, | 1717 // should have been posted. A frame should not be drawn (note, |
| 1718 // didCommitAndDrawFrame may be called anyway). | 1718 // DidCommitAndDrawFrame may be called anyway). |
| 1719 // Commit 4: Triggered by the eviction, let it go through and then set | 1719 // Commit 4: Triggered by the eviction, let it go through and then set |
| 1720 // needsCommit. | 1720 // needsCommit. |
| 1721 // Commit 5: Triggered by the setNeedsCommit, post an eviction task in | 1721 // Commit 5: Triggered by the setNeedsCommit, post an eviction task in |
| 1722 // Layout(), a frame should not be drawn but a commit will be posted. | 1722 // Layout(), a frame should not be drawn but a commit will be posted. |
| 1723 // Commit 6: Triggered by the eviction, post an eviction task in | 1723 // Commit 6: Triggered by the eviction, post an eviction task in |
| 1724 // Layout(), which will be a noop, letting the commit (which recreates the | 1724 // Layout(), which will be a noop, letting the commit (which recreates the |
| 1725 // textures) go through and draw a frame, then end the test. | 1725 // textures) go through and draw a frame, then end the test. |
| 1726 // | 1726 // |
| 1727 // Commits 1+2 test the eviction recovery path where eviction happens outside | 1727 // Commits 1+2 test the eviction recovery path where eviction happens outside |
| 1728 // of the beginFrame/commit pair. | 1728 // of the beginFrame/commit pair. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 void Layout() override { | 1765 void Layout() override { |
| 1766 ++num_commits_; | 1766 ++num_commits_; |
| 1767 switch (num_commits_) { | 1767 switch (num_commits_) { |
| 1768 case 1: | 1768 case 1: |
| 1769 case 2: | 1769 case 2: |
| 1770 break; | 1770 break; |
| 1771 case 3: | 1771 case 3: |
| 1772 PostEvictTextures(); | 1772 PostEvictTextures(); |
| 1773 break; | 1773 break; |
| 1774 case 4: | 1774 case 4: |
| 1775 // We couldn't check in didCommitAndDrawFrame on commit 3, | 1775 // We couldn't check in DidCommitAndDrawFrame on commit 3, |
| 1776 // so check here. | 1776 // so check here. |
| 1777 EXPECT_FALSE(layer_->HaveBackingTexture()); | 1777 EXPECT_FALSE(layer_->HaveBackingTexture()); |
| 1778 break; | 1778 break; |
| 1779 case 5: | 1779 case 5: |
| 1780 PostEvictTextures(); | 1780 PostEvictTextures(); |
| 1781 break; | 1781 break; |
| 1782 case 6: | 1782 case 6: |
| 1783 // We couldn't check in didCommitAndDrawFrame on commit 5, | 1783 // We couldn't check in DidCommitAndDrawFrame on commit 5, |
| 1784 // so check here. | 1784 // so check here. |
| 1785 EXPECT_FALSE(layer_->HaveBackingTexture()); | 1785 EXPECT_FALSE(layer_->HaveBackingTexture()); |
| 1786 PostEvictTextures(); | 1786 PostEvictTextures(); |
| 1787 break; | 1787 break; |
| 1788 default: | 1788 default: |
| 1789 NOTREACHED(); | 1789 NOTREACHED(); |
| 1790 break; | 1790 break; |
| 1791 } | 1791 } |
| 1792 } | 1792 } |
| 1793 | 1793 |
| (...skipping 4955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6749 void AfterTest() override {} | 6749 void AfterTest() override {} |
| 6750 | 6750 |
| 6751 scoped_refptr<FakePictureLayer> content_child_layer_; | 6751 scoped_refptr<FakePictureLayer> content_child_layer_; |
| 6752 FakeContentLayerClient client_; | 6752 FakeContentLayerClient client_; |
| 6753 }; | 6753 }; |
| 6754 | 6754 |
| 6755 SINGLE_AND_MULTI_THREAD_TEST_F( | 6755 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 6756 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); | 6756 LayerTreeTestReflectionMaskLayerForSurfaceWithUnclippedChild); |
| 6757 | 6757 |
| 6758 } // namespace cc | 6758 } // namespace cc |
| OLD | NEW |