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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/synchronization/lock.h" | 7 #include "base/synchronization/lock.h" |
8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
9 #include "cc/content_layer_client.h" | 9 #include "cc/content_layer_client.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
11 #include "cc/layer_tree_host_impl.h" | 11 #include "cc/layer_tree_host_impl.h" |
12 #include "cc/layer_tree_impl.h" | 12 #include "cc/layer_tree_impl.h" |
13 #include "cc/output_surface.h" | 13 #include "cc/output_surface.h" |
14 #include "cc/resource_update_queue.h" | |
14 #include "cc/single_thread_proxy.h" | 15 #include "cc/single_thread_proxy.h" |
15 #include "cc/test/fake_content_layer.h" | 16 #include "cc/test/fake_content_layer.h" |
16 #include "cc/test/fake_content_layer_client.h" | 17 #include "cc/test/fake_content_layer_client.h" |
17 #include "cc/test/fake_layer_tree_host_client.h" | 18 #include "cc/test/fake_layer_tree_host_client.h" |
18 #include "cc/test/fake_output_surface.h" | 19 #include "cc/test/fake_output_surface.h" |
19 #include "cc/test/fake_proxy.h" | 20 #include "cc/test/fake_proxy.h" |
20 #include "cc/test/fake_scrollbar_layer.h" | 21 #include "cc/test/fake_scrollbar_layer.h" |
21 #include "cc/test/geometry_test_utils.h" | 22 #include "cc/test/geometry_test_utils.h" |
22 #include "cc/test/layer_tree_test_common.h" | 23 #include "cc/test/layer_tree_test_common.h" |
23 #include "cc/resource_update_queue.h" | |
24 #include "cc/test/occlusion_tracker_test_common.h" | 24 #include "cc/test/occlusion_tracker_test_common.h" |
25 #include "cc/thread_proxy.h" | |
25 #include "cc/timing_function.h" | 26 #include "cc/timing_function.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
27 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 28 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
28 #include "third_party/khronos/GLES2/gl2.h" | 29 #include "third_party/khronos/GLES2/gl2.h" |
29 #include "third_party/khronos/GLES2/gl2ext.h" | 30 #include "third_party/khronos/GLES2/gl2ext.h" |
30 #include "ui/gfx/point_conversions.h" | 31 #include "ui/gfx/point_conversions.h" |
31 #include "ui/gfx/size_conversions.h" | 32 #include "ui/gfx/size_conversions.h" |
32 #include "ui/gfx/vector2d_conversions.h" | 33 #include "ui/gfx/vector2d_conversions.h" |
33 | 34 |
34 namespace cc { | 35 namespace cc { |
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2243 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender er); | 2244 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender er); |
2244 | 2245 |
2245 LayerTreeSettings settings; | 2246 LayerTreeSettings settings; |
2246 settings.maxPartialTextureUpdates = 4; | 2247 settings.maxPartialTextureUpdates = 4; |
2247 | 2248 |
2248 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); | 2249 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc oped_ptr<Thread>()); |
2249 EXPECT_TRUE(host->initializeRendererIfNeeded()); | 2250 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
2250 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); | 2251 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); |
2251 } | 2252 } |
2252 | 2253 |
2254 class LayerTreeHostTestMaxPendingFrames : public LayerTreeHostTest { | |
2255 public: | |
2256 LayerTreeHostTestMaxPendingFrames(bool delegatingRenderer) | |
2257 : LayerTreeHostTest() | |
2258 , m_delegatingRenderer(delegatingRenderer) | |
2259 { | |
2260 } | |
2261 | |
2262 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE | |
2263 { | |
2264 if (m_delegatingRenderer) | |
2265 return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface> (); | |
2266 return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); | |
2267 } | |
2268 | |
2269 virtual void beginTest() OVERRIDE | |
2270 { | |
2271 postSetNeedsCommitToMainThread(); | |
2272 } | |
2273 | |
2274 virtual void drawLayersOnThread(LayerTreeHostImpl* hostImpl) OVERRIDE | |
2275 { | |
2276 DCHECK(hostImpl->proxy()->hasImplThread()); | |
2277 | |
2278 const ThreadProxy* proxy = static_cast<ThreadProxy*>(hostImpl->proxy()); | |
2279 if (m_delegatingRenderer) | |
2280 EXPECT_EQ(1, proxy->maxFramesPendingForTesting()); | |
2281 else | |
2282 EXPECT_LT(1, proxy->maxFramesPendingForTesting()); | |
enne (OOO)
2013/01/04 21:42:05
Why does the initialization get skipped and this i
danakj
2013/01/04 21:44:45
No it's 2. 1 < maxFramesPending.
enne (OOO)
2013/01/04 21:56:43
So really:
EXPECT_EQ(FrameRateController::default
danakj
2013/01/04 22:24:07
Done.
| |
2283 endTest(); | |
2284 } | |
2285 | |
2286 virtual void afterTest() OVERRIDE | |
2287 { | |
2288 } | |
2289 | |
2290 private: | |
2291 bool m_delegatingRenderer; | |
2292 }; | |
2293 | |
2294 MULTI_THREAD_TEST_P1(LayerTreeHostTestMaxPendingFrames, DelegatingRenderer, true ) | |
2295 MULTI_THREAD_TEST_P1(LayerTreeHostTestMaxPendingFrames, GLRenderer, false) | |
2296 | |
2253 } // namespace | 2297 } // namespace |
2254 } // namespace cc | 2298 } // namespace cc |
OLD | NEW |