| 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 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 scoped_ptr<FakeProxy> proxy(new FakeProxy); | 2108 scoped_ptr<FakeProxy> proxy(new FakeProxy); |
| 2109 proxy->GetRendererCapabilities().allow_partial_texture_updates = false; | 2109 proxy->GetRendererCapabilities().allow_partial_texture_updates = false; |
| 2110 proxy->SetMaxPartialTextureUpdates(5); | 2110 proxy->SetMaxPartialTextureUpdates(5); |
| 2111 | 2111 |
| 2112 LayerTreeSettings settings; | 2112 LayerTreeSettings settings; |
| 2113 settings.max_partial_texture_updates = 10; | 2113 settings.max_partial_texture_updates = 10; |
| 2114 | 2114 |
| 2115 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); | 2115 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); |
| 2116 EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded()); | 2116 EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded()); |
| 2117 | 2117 |
| 2118 EXPECT_EQ(0u, host.settings().max_partial_texture_updates); | 2118 EXPECT_EQ(0u, host.max_partial_texture_updates()); |
| 2119 } | 2119 } |
| 2120 | 2120 |
| 2121 // When partial updates are allowed, | 2121 // When partial updates are allowed, |
| 2122 // max updates should be limited by the proxy. | 2122 // max updates should be limited by the proxy. |
| 2123 { | 2123 { |
| 2124 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 2124 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 2125 | 2125 |
| 2126 scoped_ptr<FakeProxy> proxy(new FakeProxy); | 2126 scoped_ptr<FakeProxy> proxy(new FakeProxy); |
| 2127 proxy->GetRendererCapabilities().allow_partial_texture_updates = true; | 2127 proxy->GetRendererCapabilities().allow_partial_texture_updates = true; |
| 2128 proxy->SetMaxPartialTextureUpdates(5); | 2128 proxy->SetMaxPartialTextureUpdates(5); |
| 2129 | 2129 |
| 2130 LayerTreeSettings settings; | 2130 LayerTreeSettings settings; |
| 2131 settings.max_partial_texture_updates = 10; | 2131 settings.max_partial_texture_updates = 10; |
| 2132 | 2132 |
| 2133 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); | 2133 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); |
| 2134 EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded()); | 2134 EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded()); |
| 2135 | 2135 |
| 2136 EXPECT_EQ(5u, host.settings().max_partial_texture_updates); | 2136 EXPECT_EQ(5u, host.max_partial_texture_updates()); |
| 2137 } | 2137 } |
| 2138 | 2138 |
| 2139 // When partial updates are allowed, | 2139 // When partial updates are allowed, |
| 2140 // max updates should also be limited by the settings. | 2140 // max updates should also be limited by the settings. |
| 2141 { | 2141 { |
| 2142 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 2142 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 2143 | 2143 |
| 2144 scoped_ptr<FakeProxy> proxy(new FakeProxy); | 2144 scoped_ptr<FakeProxy> proxy(new FakeProxy); |
| 2145 proxy->GetRendererCapabilities().allow_partial_texture_updates = true; | 2145 proxy->GetRendererCapabilities().allow_partial_texture_updates = true; |
| 2146 proxy->SetMaxPartialTextureUpdates(20); | 2146 proxy->SetMaxPartialTextureUpdates(20); |
| 2147 | 2147 |
| 2148 LayerTreeSettings settings; | 2148 LayerTreeSettings settings; |
| 2149 settings.max_partial_texture_updates = 10; | 2149 settings.max_partial_texture_updates = 10; |
| 2150 | 2150 |
| 2151 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); | 2151 LayerTreeHostWithProxy host(&client, settings, proxy.Pass()); |
| 2152 EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded()); | 2152 EXPECT_TRUE(host.InitializeOutputSurfaceIfNeeded()); |
| 2153 | 2153 |
| 2154 EXPECT_EQ(10u, host.settings().max_partial_texture_updates); | 2154 EXPECT_EQ(10u, host.max_partial_texture_updates()); |
| 2155 } | 2155 } |
| 2156 } | 2156 } |
| 2157 | 2157 |
| 2158 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { | 2158 TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) { |
| 2159 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 2159 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
| 2160 | 2160 |
| 2161 LayerTreeSettings settings; | 2161 LayerTreeSettings settings; |
| 2162 settings.max_partial_texture_updates = 4; | 2162 settings.max_partial_texture_updates = 4; |
| 2163 | 2163 |
| 2164 scoped_ptr<LayerTreeHost> host = | 2164 scoped_ptr<LayerTreeHost> host = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2181 | 2181 |
| 2182 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { | 2182 TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) { |
| 2183 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); | 2183 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_3D); |
| 2184 | 2184 |
| 2185 LayerTreeSettings settings; | 2185 LayerTreeSettings settings; |
| 2186 settings.max_partial_texture_updates = 4; | 2186 settings.max_partial_texture_updates = 4; |
| 2187 | 2187 |
| 2188 scoped_ptr<LayerTreeHost> host = | 2188 scoped_ptr<LayerTreeHost> host = |
| 2189 LayerTreeHost::Create(&client, settings, NULL); | 2189 LayerTreeHost::Create(&client, settings, NULL); |
| 2190 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2190 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
| 2191 EXPECT_EQ(0u, host->settings().max_partial_texture_updates); | 2191 EXPECT_EQ(0u, host->max_partial_texture_updates()); |
| 2192 } | 2192 } |
| 2193 | 2193 |
| 2194 TEST(LayerTreeHostTest, | 2194 TEST(LayerTreeHostTest, |
| 2195 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { | 2195 PartialUpdatesWithDelegatingRendererAndSoftwareContent) { |
| 2196 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); | 2196 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DELEGATED_SOFTWARE); |
| 2197 | 2197 |
| 2198 LayerTreeSettings settings; | 2198 LayerTreeSettings settings; |
| 2199 settings.max_partial_texture_updates = 4; | 2199 settings.max_partial_texture_updates = 4; |
| 2200 | 2200 |
| 2201 scoped_ptr<LayerTreeHost> host = | 2201 scoped_ptr<LayerTreeHost> host = |
| 2202 LayerTreeHost::Create(&client, settings, NULL); | 2202 LayerTreeHost::Create(&client, settings, NULL); |
| 2203 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); | 2203 EXPECT_TRUE(host->InitializeOutputSurfaceIfNeeded()); |
| 2204 EXPECT_EQ(0u, host->settings().max_partial_texture_updates); | 2204 EXPECT_EQ(0u, host->max_partial_texture_updates()); |
| 2205 } | 2205 } |
| 2206 | 2206 |
| 2207 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted | 2207 class LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted |
| 2208 : public LayerTreeHostTest { | 2208 : public LayerTreeHostTest { |
| 2209 public: | 2209 public: |
| 2210 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() | 2210 LayerTreeHostTestShutdownWithOnlySomeResourcesEvicted() |
| 2211 : root_layer_(FakeContentLayer::Create(&client_)), | 2211 : root_layer_(FakeContentLayer::Create(&client_)), |
| 2212 child_layer1_(FakeContentLayer::Create(&client_)), | 2212 child_layer1_(FakeContentLayer::Create(&client_)), |
| 2213 child_layer2_(FakeContentLayer::Create(&client_)), | 2213 child_layer2_(FakeContentLayer::Create(&client_)), |
| 2214 num_commits_(0) {} | 2214 num_commits_(0) {} |
| (...skipping 2647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4862 : public LayerTreeHostTestOffscreenContext { | 4862 : public LayerTreeHostTestOffscreenContext { |
| 4863 protected: | 4863 protected: |
| 4864 LayerTreeHostTestOffscreenContext_WithContext() { with_context_ = true; } | 4864 LayerTreeHostTestOffscreenContext_WithContext() { with_context_ = true; } |
| 4865 }; | 4865 }; |
| 4866 | 4866 |
| 4867 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_WithContext); | 4867 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_WithContext); |
| 4868 | 4868 |
| 4869 } // namespace | 4869 } // namespace |
| 4870 | 4870 |
| 4871 } // namespace cc | 4871 } // namespace cc |
| OLD | NEW |