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

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

Issue 348093004: Make cc output surface creation async (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 1968
1969 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); 1969 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits);
1970 1970
1971 class LayerTreeHostWithProxy : public LayerTreeHost { 1971 class LayerTreeHostWithProxy : public LayerTreeHost {
1972 public: 1972 public:
1973 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, 1973 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client,
1974 const LayerTreeSettings& settings, 1974 const LayerTreeSettings& settings,
1975 scoped_ptr<FakeProxy> proxy) 1975 scoped_ptr<FakeProxy> proxy)
1976 : LayerTreeHost(client, NULL, settings) { 1976 : LayerTreeHost(client, NULL, settings) {
1977 proxy->SetLayerTreeHost(this); 1977 proxy->SetLayerTreeHost(this);
1978 client->SetLayerTreeHost(this);
1978 InitializeForTesting(proxy.PassAs<Proxy>()); 1979 InitializeForTesting(proxy.PassAs<Proxy>());
1979 } 1980 }
1980 }; 1981 };
1981 1982
1982 TEST(LayerTreeHostTest, LimitPartialUpdates) { 1983 TEST(LayerTreeHostTest, LimitPartialUpdates) {
1983 // When partial updates are not allowed, max updates should be 0. 1984 // When partial updates are not allowed, max updates should be 0.
1984 { 1985 {
1985 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 1986 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
1986 1987
1987 scoped_ptr<FakeProxy> proxy(new FakeProxy); 1988 scoped_ptr<FakeProxy> proxy(new FakeProxy);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { 2038 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) {
2038 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); 2039 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
2039 2040
2040 LayerTreeSettings settings; 2041 LayerTreeSettings settings;
2041 settings.max_partial_texture_updates = 4; 2042 settings.max_partial_texture_updates = 4;
2042 2043
2043 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2044 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2044 new TestSharedBitmapManager()); 2045 new TestSharedBitmapManager());
2045 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( 2046 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
2046 &client, &client, shared_bitmap_manager.get(), settings); 2047 &client, &client, shared_bitmap_manager.get(), settings);
2048 client.SetLayerTreeHost(host.get());
2047 host->Composite(base::TimeTicks::Now()); 2049 host->Composite(base::TimeTicks::Now());
2048 2050
2049 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 2051 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
2050 } 2052 }
2051 2053
2052 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { 2054 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) {
2053 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); 2055 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE);
2054 2056
2055 LayerTreeSettings settings; 2057 LayerTreeSettings settings;
2056 settings.max_partial_texture_updates = 4; 2058 settings.max_partial_texture_updates = 4;
2057 2059
2058 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2060 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2059 new TestSharedBitmapManager()); 2061 new TestSharedBitmapManager());
2060 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( 2062 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
2061 &client, &client, shared_bitmap_manager.get(), settings); 2063 &client, &client, shared_bitmap_manager.get(), settings);
2064 client.SetLayerTreeHost(host.get());
2062 host->Composite(base::TimeTicks::Now()); 2065 host->Composite(base::TimeTicks::Now());
2063 2066
2064 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); 2067 EXPECT_EQ(4u, host->settings().max_partial_texture_updates);
2065 } 2068 }
2066 2069
2067 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { 2070 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) {
2068 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); 2071 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D);
2069 2072
2070 LayerTreeSettings settings; 2073 LayerTreeSettings settings;
2071 settings.max_partial_texture_updates = 4; 2074 settings.max_partial_texture_updates = 4;
2072 2075
2073 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2076 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2074 new TestSharedBitmapManager()); 2077 new TestSharedBitmapManager());
2075 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( 2078 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
2076 &client, &client, shared_bitmap_manager.get(), settings); 2079 &client, &client, shared_bitmap_manager.get(), settings);
2080 client.SetLayerTreeHost(host.get());
2077 host->Composite(base::TimeTicks::Now()); 2081 host->Composite(base::TimeTicks::Now());
2078 2082
2079 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2083 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2080 } 2084 }
2081 2085
2082 TEST(LayerTreeHostTest, 2086 TEST(LayerTreeHostTest,
2083 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { 2087 PartialUpdatesWithDelegatingRendererAndSoftwareContent) {
2084 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); 2088 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE);
2085 2089
2086 LayerTreeSettings settings; 2090 LayerTreeSettings settings;
2087 settings.max_partial_texture_updates = 4; 2091 settings.max_partial_texture_updates = 4;
2088 2092
2089 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 2093 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
2090 new TestSharedBitmapManager()); 2094 new TestSharedBitmapManager());
2091 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( 2095 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded(
2092 &client, &client, shared_bitmap_manager.get(), settings); 2096 &client, &client, shared_bitmap_manager.get(), settings);
2097 client.SetLayerTreeHost(host.get());
2093 host->Composite(base::TimeTicks::Now()); 2098 host->Composite(base::TimeTicks::Now());
2094 2099
2095 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); 2100 EXPECT_EQ(0u, host->MaxPartialTextureUpdates());
2096 } 2101 }
2097 2102
2098 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted 2103 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted
2099 : public LayerTreeHostTest { 2104 : public LayerTreeHostTest {
2100 public: 2105 public:
2101 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() 2106 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted()
2102 : root_layer_(FakeContentLayer::Create(&client_)), 2107 : root_layer_(FakeContentLayer::Create(&client_)),
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after
4894 const gfx::Size bounds_; 4899 const gfx::Size bounds_;
4895 FakeContentLayerClient client_; 4900 FakeContentLayerClient client_;
4896 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; 4901 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_;
4897 scoped_refptr<FakePictureLayer> picture_layer_; 4902 scoped_refptr<FakePictureLayer> picture_layer_;
4898 Layer* child_layer_; 4903 Layer* child_layer_;
4899 }; 4904 };
4900 4905
4901 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); 4906 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting);
4902 4907
4903 } // namespace cc 4908 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698