| 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 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 int num_complete_commits_; | 1896 int num_complete_commits_; |
| 1897 }; | 1897 }; |
| 1898 | 1898 |
| 1899 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); | 1899 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); |
| 1900 | 1900 |
| 1901 class LayerTreeHostWithProxy : public LayerTreeHost { | 1901 class LayerTreeHostWithProxy : public LayerTreeHost { |
| 1902 public: | 1902 public: |
| 1903 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, | 1903 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, |
| 1904 const LayerTreeSettings& settings, | 1904 const LayerTreeSettings& settings, |
| 1905 scoped_ptr<FakeProxy> proxy) | 1905 scoped_ptr<FakeProxy> proxy) |
| 1906 : LayerTreeHost(client, NULL, settings) { | 1906 : LayerTreeHost(client, NULL, NULL, settings) { |
| 1907 proxy->SetLayerTreeHost(this); | 1907 proxy->SetLayerTreeHost(this); |
| 1908 client->SetLayerTreeHost(this); | 1908 client->SetLayerTreeHost(this); |
| 1909 InitializeForTesting(proxy.Pass()); | 1909 InitializeForTesting(proxy.Pass()); |
| 1910 } | 1910 } |
| 1911 }; | 1911 }; |
| 1912 | 1912 |
| 1913 TEST(LayerTreeHostTest, LimitPartialUpdates) { | 1913 TEST(LayerTreeHostTest, LimitPartialUpdates) { |
| 1914 // When partial updates are not allowed, max updates should be 0. | 1914 // When partial updates are not allowed, max updates should be 0. |
| 1915 { | 1915 { |
| 1916 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 1916 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 LayerTreeSettings settings; | 1971 LayerTreeSettings settings; |
| 1972 settings.max_partial_texture_updates = 4; | 1972 settings.max_partial_texture_updates = 4; |
| 1973 settings.single_thread_proxy_scheduler = false; | 1973 settings.single_thread_proxy_scheduler = false; |
| 1974 | 1974 |
| 1975 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1975 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 1976 new TestSharedBitmapManager()); | 1976 new TestSharedBitmapManager()); |
| 1977 scoped_ptr<LayerTreeHost> host = | 1977 scoped_ptr<LayerTreeHost> host = |
| 1978 LayerTreeHost::CreateSingleThreaded(&client, | 1978 LayerTreeHost::CreateSingleThreaded(&client, |
| 1979 &client, | 1979 &client, |
| 1980 shared_bitmap_manager.get(), | 1980 shared_bitmap_manager.get(), |
| 1981 NULL, |
| 1981 settings, | 1982 settings, |
| 1982 base::MessageLoopProxy::current()); | 1983 base::MessageLoopProxy::current()); |
| 1983 client.SetLayerTreeHost(host.get()); | 1984 client.SetLayerTreeHost(host.get()); |
| 1984 host->Composite(base::TimeTicks::Now()); | 1985 host->Composite(base::TimeTicks::Now()); |
| 1985 | 1986 |
| 1986 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 1987 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
| 1987 } | 1988 } |
| 1988 | 1989 |
| 1989 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { | 1990 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
| 1990 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); | 1991 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); |
| 1991 | 1992 |
| 1992 LayerTreeSettings settings; | 1993 LayerTreeSettings settings; |
| 1993 settings.max_partial_texture_updates = 4; | 1994 settings.max_partial_texture_updates = 4; |
| 1994 settings.single_thread_proxy_scheduler = false; | 1995 settings.single_thread_proxy_scheduler = false; |
| 1995 | 1996 |
| 1996 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1997 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 1997 new TestSharedBitmapManager()); | 1998 new TestSharedBitmapManager()); |
| 1998 scoped_ptr<LayerTreeHost> host = | 1999 scoped_ptr<LayerTreeHost> host = |
| 1999 LayerTreeHost::CreateSingleThreaded(&client, | 2000 LayerTreeHost::CreateSingleThreaded(&client, |
| 2000 &client, | 2001 &client, |
| 2001 shared_bitmap_manager.get(), | 2002 shared_bitmap_manager.get(), |
| 2003 NULL, |
| 2002 settings, | 2004 settings, |
| 2003 base::MessageLoopProxy::current()); | 2005 base::MessageLoopProxy::current()); |
| 2004 client.SetLayerTreeHost(host.get()); | 2006 client.SetLayerTreeHost(host.get()); |
| 2005 host->Composite(base::TimeTicks::Now()); | 2007 host->Composite(base::TimeTicks::Now()); |
| 2006 | 2008 |
| 2007 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2009 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
| 2008 } | 2010 } |
| 2009 | 2011 |
| 2010 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2012 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
| 2011 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2013 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
| 2012 | 2014 |
| 2013 LayerTreeSettings settings; | 2015 LayerTreeSettings settings; |
| 2014 settings.max_partial_texture_updates = 4; | 2016 settings.max_partial_texture_updates = 4; |
| 2015 settings.single_thread_proxy_scheduler = false; | 2017 settings.single_thread_proxy_scheduler = false; |
| 2016 | 2018 |
| 2017 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2019 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 2018 new TestSharedBitmapManager()); | 2020 new TestSharedBitmapManager()); |
| 2019 scoped_ptr<LayerTreeHost> host = | 2021 scoped_ptr<LayerTreeHost> host = |
| 2020 LayerTreeHost::CreateSingleThreaded(&client, | 2022 LayerTreeHost::CreateSingleThreaded(&client, |
| 2021 &client, | 2023 &client, |
| 2022 shared_bitmap_manager.get(), | 2024 shared_bitmap_manager.get(), |
| 2025 NULL, |
| 2023 settings, | 2026 settings, |
| 2024 base::MessageLoopProxy::current()); | 2027 base::MessageLoopProxy::current()); |
| 2025 client.SetLayerTreeHost(host.get()); | 2028 client.SetLayerTreeHost(host.get()); |
| 2026 host->Composite(base::TimeTicks::Now()); | 2029 host->Composite(base::TimeTicks::Now()); |
| 2027 | 2030 |
| 2028 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2031 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
| 2029 } | 2032 } |
| 2030 | 2033 |
| 2031 TEST(LayerTreeHostTest, | 2034 TEST(LayerTreeHostTest, |
| 2032 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2035 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
| 2033 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2036 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
| 2034 | 2037 |
| 2035 LayerTreeSettings settings; | 2038 LayerTreeSettings settings; |
| 2036 settings.max_partial_texture_updates = 4; | 2039 settings.max_partial_texture_updates = 4; |
| 2037 settings.single_thread_proxy_scheduler = false; | 2040 settings.single_thread_proxy_scheduler = false; |
| 2038 | 2041 |
| 2039 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2042 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 2040 new TestSharedBitmapManager()); | 2043 new TestSharedBitmapManager()); |
| 2041 scoped_ptr<LayerTreeHost> host = | 2044 scoped_ptr<LayerTreeHost> host = |
| 2042 LayerTreeHost::CreateSingleThreaded(&client, | 2045 LayerTreeHost::CreateSingleThreaded(&client, |
| 2043 &client, | 2046 &client, |
| 2044 shared_bitmap_manager.get(), | 2047 shared_bitmap_manager.get(), |
| 2048 NULL, |
| 2045 settings, | 2049 settings, |
| 2046 base::MessageLoopProxy::current()); | 2050 base::MessageLoopProxy::current()); |
| 2047 client.SetLayerTreeHost(host.get()); | 2051 client.SetLayerTreeHost(host.get()); |
| 2048 host->Composite(base::TimeTicks::Now()); | 2052 host->Composite(base::TimeTicks::Now()); |
| 2049 | 2053 |
| 2050 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2054 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
| 2051 } | 2055 } |
| 2052 | 2056 |
| 2053 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2057 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
| 2054 : public LayerTreeHostTest { | 2058 : public LayerTreeHostTest { |
| (...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5160 } | 5164 } |
| 5161 | 5165 |
| 5162 int commit_count_; | 5166 int commit_count_; |
| 5163 TestSwapPromiseResult swap_promise_result_[3]; | 5167 TestSwapPromiseResult swap_promise_result_[3]; |
| 5164 }; | 5168 }; |
| 5165 | 5169 |
| 5166 // Impl-side painting is not supported for synchronous compositing. | 5170 // Impl-side painting is not supported for synchronous compositing. |
| 5167 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise); | 5171 SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise); |
| 5168 | 5172 |
| 5169 } // namespace cc | 5173 } // namespace cc |
| OLD | NEW |