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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 int num_complete_commits_; | 1893 int num_complete_commits_; |
1894 }; | 1894 }; |
1895 | 1895 |
1896 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); | 1896 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); |
1897 | 1897 |
1898 class LayerTreeHostWithProxy : public LayerTreeHost { | 1898 class LayerTreeHostWithProxy : public LayerTreeHost { |
1899 public: | 1899 public: |
1900 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, | 1900 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, |
1901 const LayerTreeSettings& settings, | 1901 const LayerTreeSettings& settings, |
1902 scoped_ptr<FakeProxy> proxy) | 1902 scoped_ptr<FakeProxy> proxy) |
1903 : LayerTreeHost(client, NULL, settings) { | 1903 : LayerTreeHost(client, NULL, NULL, settings) { |
1904 proxy->SetLayerTreeHost(this); | 1904 proxy->SetLayerTreeHost(this); |
1905 client->SetLayerTreeHost(this); | 1905 client->SetLayerTreeHost(this); |
1906 InitializeForTesting(proxy.Pass()); | 1906 InitializeForTesting(proxy.Pass()); |
1907 } | 1907 } |
1908 }; | 1908 }; |
1909 | 1909 |
1910 TEST(LayerTreeHostTest, LimitPartialUpdates) { | 1910 TEST(LayerTreeHostTest, LimitPartialUpdates) { |
1911 // When partial updates are not allowed, max updates should be 0. | 1911 // When partial updates are not allowed, max updates should be 0. |
1912 { | 1912 { |
1913 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 1913 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1968 LayerTreeSettings settings; | 1968 LayerTreeSettings settings; |
1969 settings.max_partial_texture_updates = 4; | 1969 settings.max_partial_texture_updates = 4; |
1970 settings.single_thread_proxy_scheduler = false; | 1970 settings.single_thread_proxy_scheduler = false; |
1971 | 1971 |
1972 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1972 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1973 new TestSharedBitmapManager()); | 1973 new TestSharedBitmapManager()); |
1974 scoped_ptr<LayerTreeHost> host = | 1974 scoped_ptr<LayerTreeHost> host = |
1975 LayerTreeHost::CreateSingleThreaded(&client, | 1975 LayerTreeHost::CreateSingleThreaded(&client, |
1976 &client, | 1976 &client, |
1977 shared_bitmap_manager.get(), | 1977 shared_bitmap_manager.get(), |
| 1978 NULL, |
1978 settings, | 1979 settings, |
1979 base::MessageLoopProxy::current()); | 1980 base::MessageLoopProxy::current()); |
1980 client.SetLayerTreeHost(host.get()); | 1981 client.SetLayerTreeHost(host.get()); |
1981 host->Composite(base::TimeTicks::Now()); | 1982 host->Composite(base::TimeTicks::Now()); |
1982 | 1983 |
1983 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 1984 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
1984 } | 1985 } |
1985 | 1986 |
1986 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { | 1987 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
1987 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); | 1988 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); |
1988 | 1989 |
1989 LayerTreeSettings settings; | 1990 LayerTreeSettings settings; |
1990 settings.max_partial_texture_updates = 4; | 1991 settings.max_partial_texture_updates = 4; |
1991 settings.single_thread_proxy_scheduler = false; | 1992 settings.single_thread_proxy_scheduler = false; |
1992 | 1993 |
1993 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1994 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1994 new TestSharedBitmapManager()); | 1995 new TestSharedBitmapManager()); |
1995 scoped_ptr<LayerTreeHost> host = | 1996 scoped_ptr<LayerTreeHost> host = |
1996 LayerTreeHost::CreateSingleThreaded(&client, | 1997 LayerTreeHost::CreateSingleThreaded(&client, |
1997 &client, | 1998 &client, |
1998 shared_bitmap_manager.get(), | 1999 shared_bitmap_manager.get(), |
| 2000 NULL, |
1999 settings, | 2001 settings, |
2000 base::MessageLoopProxy::current()); | 2002 base::MessageLoopProxy::current()); |
2001 client.SetLayerTreeHost(host.get()); | 2003 client.SetLayerTreeHost(host.get()); |
2002 host->Composite(base::TimeTicks::Now()); | 2004 host->Composite(base::TimeTicks::Now()); |
2003 | 2005 |
2004 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2006 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2005 } | 2007 } |
2006 | 2008 |
2007 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2009 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
2008 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2010 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
2009 | 2011 |
2010 LayerTreeSettings settings; | 2012 LayerTreeSettings settings; |
2011 settings.max_partial_texture_updates = 4; | 2013 settings.max_partial_texture_updates = 4; |
2012 settings.single_thread_proxy_scheduler = false; | 2014 settings.single_thread_proxy_scheduler = false; |
2013 | 2015 |
2014 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2016 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2015 new TestSharedBitmapManager()); | 2017 new TestSharedBitmapManager()); |
2016 scoped_ptr<LayerTreeHost> host = | 2018 scoped_ptr<LayerTreeHost> host = |
2017 LayerTreeHost::CreateSingleThreaded(&client, | 2019 LayerTreeHost::CreateSingleThreaded(&client, |
2018 &client, | 2020 &client, |
2019 shared_bitmap_manager.get(), | 2021 shared_bitmap_manager.get(), |
| 2022 NULL, |
2020 settings, | 2023 settings, |
2021 base::MessageLoopProxy::current()); | 2024 base::MessageLoopProxy::current()); |
2022 client.SetLayerTreeHost(host.get()); | 2025 client.SetLayerTreeHost(host.get()); |
2023 host->Composite(base::TimeTicks::Now()); | 2026 host->Composite(base::TimeTicks::Now()); |
2024 | 2027 |
2025 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2028 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2026 } | 2029 } |
2027 | 2030 |
2028 TEST(LayerTreeHostTest, | 2031 TEST(LayerTreeHostTest, |
2029 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2032 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
2030 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2033 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
2031 | 2034 |
2032 LayerTreeSettings settings; | 2035 LayerTreeSettings settings; |
2033 settings.max_partial_texture_updates = 4; | 2036 settings.max_partial_texture_updates = 4; |
2034 settings.single_thread_proxy_scheduler = false; | 2037 settings.single_thread_proxy_scheduler = false; |
2035 | 2038 |
2036 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2039 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2037 new TestSharedBitmapManager()); | 2040 new TestSharedBitmapManager()); |
2038 scoped_ptr<LayerTreeHost> host = | 2041 scoped_ptr<LayerTreeHost> host = |
2039 LayerTreeHost::CreateSingleThreaded(&client, | 2042 LayerTreeHost::CreateSingleThreaded(&client, |
2040 &client, | 2043 &client, |
2041 shared_bitmap_manager.get(), | 2044 shared_bitmap_manager.get(), |
| 2045 NULL, |
2042 settings, | 2046 settings, |
2043 base::MessageLoopProxy::current()); | 2047 base::MessageLoopProxy::current()); |
2044 client.SetLayerTreeHost(host.get()); | 2048 client.SetLayerTreeHost(host.get()); |
2045 host->Composite(base::TimeTicks::Now()); | 2049 host->Composite(base::TimeTicks::Now()); |
2046 | 2050 |
2047 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2051 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2048 } | 2052 } |
2049 | 2053 |
2050 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2054 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
2051 : public LayerTreeHostTest { | 2055 : public LayerTreeHostTest { |
(...skipping 3021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5073 bool visible_; | 5077 bool visible_; |
5074 | 5078 |
5075 FakeContentLayerClient client_; | 5079 FakeContentLayerClient client_; |
5076 scoped_refptr<FakePictureLayer> picture_layer_; | 5080 scoped_refptr<FakePictureLayer> picture_layer_; |
5077 }; | 5081 }; |
5078 | 5082 |
5079 // TODO(vmpstr): Enable with single thread impl-side painting. | 5083 // TODO(vmpstr): Enable with single thread impl-side painting. |
5080 MULTI_THREAD_TEST_F(LayerTreeHostTestActivateOnInvisible); | 5084 MULTI_THREAD_TEST_F(LayerTreeHostTestActivateOnInvisible); |
5081 | 5085 |
5082 } // namespace cc | 5086 } // namespace cc |
OLD | NEW |