Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 606113003: Revert of Make cc output surface creation async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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);
1906 InitializeForTesting(proxy.PassAs<Proxy>()); 1905 InitializeForTesting(proxy.PassAs<Proxy>());
1907 } 1906 }
1908 }; 1907 };
1909 1908
1910 TEST(LayerTreeHostTest, LimitPartialUpdates) { 1909 TEST(LayerTreeHostTest, LimitPartialUpdates) {
1911 // When partial updates are not allowed, max updates should be 0. 1910 // When partial updates are not allowed, max updates should be 0.
1912 { 1911 {
1913 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 1912 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
1914 1913
1915 scoped_ptr<FakeProxy> proxy(new FakeProxy); 1914 scoped_ptr<FakeProxy> proxy(new FakeProxy);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 settings.single_thread_proxy_scheduler = false; 1969 settings.single_thread_proxy_scheduler = false;
1971 1970
1972 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 1971 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
1973 new TestSharedBitmapManager()); 1972 new TestSharedBitmapManager());
1974 scoped_ptr<LayerTreeHost> host = 1973 scoped_ptr<LayerTreeHost> host =
1975 LayerTreeHost::CreateSingleThreaded(&client, 1974 LayerTreeHost::CreateSingleThreaded(&client,
1976 &client, 1975 &client,
1977 shared_bitmap_manager.get(), 1976 shared_bitmap_manager.get(),
1978 settings, 1977 settings,
1979 base::MessageLoopProxy::current()); 1978 base::MessageLoopProxy::current());
1980 client.SetLayerTreeHost(host.get());
1981 host->Composite(base::TimeTicks::Now()); 1979 host->Composite(base::TimeTicks::Now());
1982 1980
1983 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 1981 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
1984 } 1982 }
1985 1983
1986 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { 1984 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) {
1987 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); 1985 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE);
1988 1986
1989 LayerTreeSettings settings; 1987 LayerTreeSettings settings;
1990 settings.max_partial_texture_updates = 4; 1988 settings.max_partial_texture_updates = 4;
1991 settings.single_thread_proxy_scheduler = false; 1989 settings.single_thread_proxy_scheduler = false;
1992 1990
1993 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 1991 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
1994 new TestSharedBitmapManager()); 1992 new TestSharedBitmapManager());
1995 scoped_ptr<LayerTreeHost> host = 1993 scoped_ptr<LayerTreeHost> host =
1996 LayerTreeHost::CreateSingleThreaded(&client, 1994 LayerTreeHost::CreateSingleThreaded(&client,
1997 &client, 1995 &client,
1998 shared_bitmap_manager.get(), 1996 shared_bitmap_manager.get(),
1999 settings, 1997 settings,
2000 base::MessageLoopProxy::current()); 1998 base::MessageLoopProxy::current());
2001 client.SetLayerTreeHost(host.get());
2002 host->Composite(base::TimeTicks::Now()); 1999 host->Composite(base::TimeTicks::Now());
2003 2000
2004 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 2001 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
2005 } 2002 }
2006 2003
2007 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { 2004 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
2008 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); 2005 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D);
2009 2006
2010 LayerTreeSettings settings; 2007 LayerTreeSettings settings;
2011 settings.max_partial_texture_updates = 4; 2008 settings.max_partial_texture_updates = 4;
2012 settings.single_thread_proxy_scheduler = false; 2009 settings.single_thread_proxy_scheduler = false;
2013 2010
2014 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2011 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2015 new TestSharedBitmapManager()); 2012 new TestSharedBitmapManager());
2016 scoped_ptr<LayerTreeHost> host = 2013 scoped_ptr<LayerTreeHost> host =
2017 LayerTreeHost::CreateSingleThreaded(&client, 2014 LayerTreeHost::CreateSingleThreaded(&client,
2018 &client, 2015 &client,
2019 shared_bitmap_manager.get(), 2016 shared_bitmap_manager.get(),
2020 settings, 2017 settings,
2021 base::MessageLoopProxy::current()); 2018 base::MessageLoopProxy::current());
2022 client.SetLayerTreeHost(host.get());
2023 host->Composite(base::TimeTicks::Now()); 2019 host->Composite(base::TimeTicks::Now());
2024 2020
2025 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2021 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2026 } 2022 }
2027 2023
2028 TEST(LayerTreeHostTest, 2024 TEST(LayerTreeHostTest,
2029 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { 2025 PartialUpdatesWithDelegatingRendererAndSoftwareContent) {
2030 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); 2026 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE);
2031 2027
2032 LayerTreeSettings settings; 2028 LayerTreeSettings settings;
2033 settings.max_partial_texture_updates = 4; 2029 settings.max_partial_texture_updates = 4;
2034 settings.single_thread_proxy_scheduler = false; 2030 settings.single_thread_proxy_scheduler = false;
2035 2031
2036 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2032 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2037 new TestSharedBitmapManager()); 2033 new TestSharedBitmapManager());
2038 scoped_ptr<LayerTreeHost> host = 2034 scoped_ptr<LayerTreeHost> host =
2039 LayerTreeHost::CreateSingleThreaded(&client, 2035 LayerTreeHost::CreateSingleThreaded(&client,
2040 &client, 2036 &client,
2041 shared_bitmap_manager.get(), 2037 shared_bitmap_manager.get(),
2042 settings, 2038 settings,
2043 base::MessageLoopProxy::current()); 2039 base::MessageLoopProxy::current());
2044 client.SetLayerTreeHost(host.get());
2045 host->Composite(base::TimeTicks::Now()); 2040 host->Composite(base::TimeTicks::Now());
2046 2041
2047 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2042 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2048 } 2043 }
2049 2044
2050 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2045 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2051 : public LayerTreeHostTest { 2046 : public LayerTreeHostTest {
2052 public: 2047 public:
2053 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2048 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2054 : root_layer_(FakeContentLayer::Create(&client_)), 2049 : root_layer_(FakeContentLayer::Create(&client_)),
(...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after
5106 int activation_count_; 5101 int activation_count_;
5107 5102
5108 FakeContentLayerClient client_; 5103 FakeContentLayerClient client_;
5109 scoped_refptr<FakePictureLayer> picture_layer_; 5104 scoped_refptr<FakePictureLayer> picture_layer_;
5110 }; 5105 };
5111 5106
5112 // TODO(vmpstr): Enable with single thread impl-side painting. 5107 // TODO(vmpstr): Enable with single thread impl-side painting.
5113 MULTI_THREAD_TEST_F(LayerTreeHostTestInvisibleDoesntActivate); 5108 MULTI_THREAD_TEST_F(LayerTreeHostTestInvisibleDoesntActivate);
5114 5109
5115 } // namespace cc 5110 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698