| 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 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, settings) { |
| 1904 proxy->SetLayerTreeHost(this); | 1904 proxy->SetLayerTreeHost(this); |
| 1905 client->SetLayerTreeHost(this); |
| 1905 InitializeForTesting(proxy.PassAs<Proxy>()); | 1906 InitializeForTesting(proxy.PassAs<Proxy>()); |
| 1906 } | 1907 } |
| 1907 }; | 1908 }; |
| 1908 | 1909 |
| 1909 TEST(LayerTreeHostTest, LimitPartialUpdates) { | 1910 TEST(LayerTreeHostTest, LimitPartialUpdates) { |
| 1910 // When partial updates are not allowed, max updates should be 0. | 1911 // When partial updates are not allowed, max updates should be 0. |
| 1911 { | 1912 { |
| 1912 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 1913 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 1913 | 1914 |
| 1914 scoped_ptr<FakeProxy> proxy(new FakeProxy); | 1915 scoped_ptr<FakeProxy> proxy(new FakeProxy); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 settings.single_thread_proxy_scheduler = false; | 1970 settings.single_thread_proxy_scheduler = false; |
| 1970 | 1971 |
| 1971 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1972 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 1972 new TestSharedBitmapManager()); | 1973 new TestSharedBitmapManager()); |
| 1973 scoped_ptr<LayerTreeHost> host = | 1974 scoped_ptr<LayerTreeHost> host = |
| 1974 LayerTreeHost::CreateSingleThreaded(&client, | 1975 LayerTreeHost::CreateSingleThreaded(&client, |
| 1975 &client, | 1976 &client, |
| 1976 shared_bitmap_manager.get(), | 1977 shared_bitmap_manager.get(), |
| 1977 settings, | 1978 settings, |
| 1978 base::MessageLoopProxy::current()); | 1979 base::MessageLoopProxy::current()); |
| 1980 client.SetLayerTreeHost(host.get()); |
| 1979 host->Composite(base::TimeTicks::Now()); | 1981 host->Composite(base::TimeTicks::Now()); |
| 1980 | 1982 |
| 1981 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 1983 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
| 1982 } | 1984 } |
| 1983 | 1985 |
| 1984 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { | 1986 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
| 1985 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); | 1987 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); |
| 1986 | 1988 |
| 1987 LayerTreeSettings settings; | 1989 LayerTreeSettings settings; |
| 1988 settings.max_partial_texture_updates = 4; | 1990 settings.max_partial_texture_updates = 4; |
| 1989 settings.single_thread_proxy_scheduler = false; | 1991 settings.single_thread_proxy_scheduler = false; |
| 1990 | 1992 |
| 1991 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1993 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 1992 new TestSharedBitmapManager()); | 1994 new TestSharedBitmapManager()); |
| 1993 scoped_ptr<LayerTreeHost> host = | 1995 scoped_ptr<LayerTreeHost> host = |
| 1994 LayerTreeHost::CreateSingleThreaded(&client, | 1996 LayerTreeHost::CreateSingleThreaded(&client, |
| 1995 &client, | 1997 &client, |
| 1996 shared_bitmap_manager.get(), | 1998 shared_bitmap_manager.get(), |
| 1997 settings, | 1999 settings, |
| 1998 base::MessageLoopProxy::current()); | 2000 base::MessageLoopProxy::current()); |
| 2001 client.SetLayerTreeHost(host.get()); |
| 1999 host->Composite(base::TimeTicks::Now()); | 2002 host->Composite(base::TimeTicks::Now()); |
| 2000 | 2003 |
| 2001 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2004 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
| 2002 } | 2005 } |
| 2003 | 2006 |
| 2004 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2007 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
| 2005 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2008 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
| 2006 | 2009 |
| 2007 LayerTreeSettings settings; | 2010 LayerTreeSettings settings; |
| 2008 settings.max_partial_texture_updates = 4; | 2011 settings.max_partial_texture_updates = 4; |
| 2009 settings.single_thread_proxy_scheduler = false; | 2012 settings.single_thread_proxy_scheduler = false; |
| 2010 | 2013 |
| 2011 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2014 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 2012 new TestSharedBitmapManager()); | 2015 new TestSharedBitmapManager()); |
| 2013 scoped_ptr<LayerTreeHost> host = | 2016 scoped_ptr<LayerTreeHost> host = |
| 2014 LayerTreeHost::CreateSingleThreaded(&client, | 2017 LayerTreeHost::CreateSingleThreaded(&client, |
| 2015 &client, | 2018 &client, |
| 2016 shared_bitmap_manager.get(), | 2019 shared_bitmap_manager.get(), |
| 2017 settings, | 2020 settings, |
| 2018 base::MessageLoopProxy::current()); | 2021 base::MessageLoopProxy::current()); |
| 2022 client.SetLayerTreeHost(host.get()); |
| 2019 host->Composite(base::TimeTicks::Now()); | 2023 host->Composite(base::TimeTicks::Now()); |
| 2020 | 2024 |
| 2021 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2025 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
| 2022 } | 2026 } |
| 2023 | 2027 |
| 2024 TEST(LayerTreeHostTest, | 2028 TEST(LayerTreeHostTest, |
| 2025 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2029 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
| 2026 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2030 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
| 2027 | 2031 |
| 2028 LayerTreeSettings settings; | 2032 LayerTreeSettings settings; |
| 2029 settings.max_partial_texture_updates = 4; | 2033 settings.max_partial_texture_updates = 4; |
| 2030 settings.single_thread_proxy_scheduler = false; | 2034 settings.single_thread_proxy_scheduler = false; |
| 2031 | 2035 |
| 2032 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2036 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 2033 new TestSharedBitmapManager()); | 2037 new TestSharedBitmapManager()); |
| 2034 scoped_ptr<LayerTreeHost> host = | 2038 scoped_ptr<LayerTreeHost> host = |
| 2035 LayerTreeHost::CreateSingleThreaded(&client, | 2039 LayerTreeHost::CreateSingleThreaded(&client, |
| 2036 &client, | 2040 &client, |
| 2037 shared_bitmap_manager.get(), | 2041 shared_bitmap_manager.get(), |
| 2038 settings, | 2042 settings, |
| 2039 base::MessageLoopProxy::current()); | 2043 base::MessageLoopProxy::current()); |
| 2044 client.SetLayerTreeHost(host.get()); |
| 2040 host->Composite(base::TimeTicks::Now()); | 2045 host->Composite(base::TimeTicks::Now()); |
| 2041 | 2046 |
| 2042 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2047 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
| 2043 } | 2048 } |
| 2044 | 2049 |
| 2045 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2050 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
| 2046 : public LayerTreeHostTest { | 2051 : public LayerTreeHostTest { |
| 2047 public: | 2052 public: |
| 2048 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() | 2053 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() |
| 2049 : root_layer_(FakeContentLayer::Create(&client_)), | 2054 : root_layer_(FakeContentLayer::Create(&client_)), |
| (...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5101 int activation_count_; | 5106 int activation_count_; |
| 5102 | 5107 |
| 5103 FakeContentLayerClient client_; | 5108 FakeContentLayerClient client_; |
| 5104 scoped_refptr<FakePictureLayer> picture_layer_; | 5109 scoped_refptr<FakePictureLayer> picture_layer_; |
| 5105 }; | 5110 }; |
| 5106 | 5111 |
| 5107 // TODO(vmpstr): Enable with single thread impl-side painting. | 5112 // TODO(vmpstr): Enable with single thread impl-side painting. |
| 5108 MULTI_THREAD_TEST_F(LayerTreeHostTestInvisibleDoesntActivate); | 5113 MULTI_THREAD_TEST_F(LayerTreeHostTestInvisibleDoesntActivate); |
| 5109 | 5114 |
| 5110 } // namespace cc | 5115 } // namespace cc |
| OLD | NEW |