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 1958 matching lines...) Loading... |
1969 | 1969 |
1970 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); | 1970 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); |
1971 | 1971 |
1972 class LayerTreeHostWithProxy : public LayerTreeHost { | 1972 class LayerTreeHostWithProxy : public LayerTreeHost { |
1973 public: | 1973 public: |
1974 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, | 1974 LayerTreeHostWithProxy(FakeLayerTreeHostClient* client, |
1975 const LayerTreeSettings& settings, | 1975 const LayerTreeSettings& settings, |
1976 scoped_ptr<FakeProxy> proxy) | 1976 scoped_ptr<FakeProxy> proxy) |
1977 : LayerTreeHost(client, NULL, settings) { | 1977 : LayerTreeHost(client, NULL, settings) { |
1978 proxy->SetLayerTreeHost(this); | 1978 proxy->SetLayerTreeHost(this); |
| 1979 client->SetLayerTreeHost(this); |
1979 InitializeForTesting(proxy.PassAs<Proxy>()); | 1980 InitializeForTesting(proxy.PassAs<Proxy>()); |
1980 } | 1981 } |
1981 }; | 1982 }; |
1982 | 1983 |
1983 TEST(LayerTreeHostTest, LimitPartialUpdates) { | 1984 TEST(LayerTreeHostTest, LimitPartialUpdates) { |
1984 // When partial updates are not allowed, max updates should be 0. | 1985 // When partial updates are not allowed, max updates should be 0. |
1985 { | 1986 { |
1986 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 1987 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
1987 | 1988 |
1988 scoped_ptr<FakeProxy> proxy(new FakeProxy); | 1989 scoped_ptr<FakeProxy> proxy(new FakeProxy); |
(...skipping 49 matching lines...) Loading... |
2038 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { | 2039 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { |
2039 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 2040 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
2040 | 2041 |
2041 LayerTreeSettings settings; | 2042 LayerTreeSettings settings; |
2042 settings.max_partial_texture_updates = 4; | 2043 settings.max_partial_texture_updates = 4; |
2043 | 2044 |
2044 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2045 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2045 new TestSharedBitmapManager()); | 2046 new TestSharedBitmapManager()); |
2046 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2047 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
2047 &client, &client, shared_bitmap_manager.get(), settings); | 2048 &client, &client, shared_bitmap_manager.get(), settings); |
| 2049 client.SetLayerTreeHost(host.get()); |
2048 host->Composite(base::TimeTicks::Now()); | 2050 host->Composite(base::TimeTicks::Now()); |
2049 | 2051 |
2050 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2052 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2051 } | 2053 } |
2052 | 2054 |
2053 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { | 2055 TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) { |
2054 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); | 2056 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_SOFTWARE); |
2055 | 2057 |
2056 LayerTreeSettings settings; | 2058 LayerTreeSettings settings; |
2057 settings.max_partial_texture_updates = 4; | 2059 settings.max_partial_texture_updates = 4; |
2058 | 2060 |
2059 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2061 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2060 new TestSharedBitmapManager()); | 2062 new TestSharedBitmapManager()); |
2061 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2063 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
2062 &client, &client, shared_bitmap_manager.get(), settings); | 2064 &client, &client, shared_bitmap_manager.get(), settings); |
| 2065 client.SetLayerTreeHost(host.get()); |
2063 host->Composite(base::TimeTicks::Now()); | 2066 host->Composite(base::TimeTicks::Now()); |
2064 | 2067 |
2065 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); | 2068 EXPECT_EQ(4u, host->settings().max_partial_texture_updates); |
2066 } | 2069 } |
2067 | 2070 |
2068 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2071 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
2069 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2072 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
2070 | 2073 |
2071 LayerTreeSettings settings; | 2074 LayerTreeSettings settings; |
2072 settings.max_partial_texture_updates = 4; | 2075 settings.max_partial_texture_updates = 4; |
2073 | 2076 |
2074 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2077 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2075 new TestSharedBitmapManager()); | 2078 new TestSharedBitmapManager()); |
2076 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2079 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
2077 &client, &client, shared_bitmap_manager.get(), settings); | 2080 &client, &client, shared_bitmap_manager.get(), settings); |
| 2081 client.SetLayerTreeHost(host.get()); |
2078 host->Composite(base::TimeTicks::Now()); | 2082 host->Composite(base::TimeTicks::Now()); |
2079 | 2083 |
2080 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2084 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2081 } | 2085 } |
2082 | 2086 |
2083 TEST(LayerTreeHostTest, | 2087 TEST(LayerTreeHostTest, |
2084 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2088 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
2085 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2089 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
2086 | 2090 |
2087 LayerTreeSettings settings; | 2091 LayerTreeSettings settings; |
2088 settings.max_partial_texture_updates = 4; | 2092 settings.max_partial_texture_updates = 4; |
2089 | 2093 |
2090 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 2094 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
2091 new TestSharedBitmapManager()); | 2095 new TestSharedBitmapManager()); |
2092 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( | 2096 scoped_ptr<LayerTreeHost> host = LayerTreeHost::CreateSingleThreaded( |
2093 &client, &client, shared_bitmap_manager.get(), settings); | 2097 &client, &client, shared_bitmap_manager.get(), settings); |
| 2098 client.SetLayerTreeHost(host.get()); |
2094 host->Composite(base::TimeTicks::Now()); | 2099 host->Composite(base::TimeTicks::Now()); |
2095 | 2100 |
2096 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); | 2101 EXPECT_EQ(0u, host->MaxPartialTextureUpdates()); |
2097 } | 2102 } |
2098 | 2103 |
2099 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2104 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
2100 : public LayerTreeHostTest { | 2105 : public LayerTreeHostTest { |
2101 public: | 2106 public: |
2102 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() | 2107 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() |
2103 : root_layer_(FakeContentLayer::Create(&client_)), | 2108 : root_layer_(FakeContentLayer::Create(&client_)), |
(...skipping 2790 matching lines...) Loading... |
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 |
OLD | NEW |