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/frame_rate_controller.h" | |
11 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
12 #include "cc/layer_tree_host_impl.h" | 11 #include "cc/layer_tree_host_impl.h" |
13 #include "cc/layer_tree_impl.h" | 12 #include "cc/layer_tree_impl.h" |
14 #include "cc/output_surface.h" | 13 #include "cc/output_surface.h" |
15 #include "cc/resource_update_queue.h" | |
16 #include "cc/single_thread_proxy.h" | 14 #include "cc/single_thread_proxy.h" |
17 #include "cc/test/fake_content_layer.h" | 15 #include "cc/test/fake_content_layer.h" |
18 #include "cc/test/fake_content_layer_client.h" | 16 #include "cc/test/fake_content_layer_client.h" |
19 #include "cc/test/fake_layer_tree_host_client.h" | 17 #include "cc/test/fake_layer_tree_host_client.h" |
20 #include "cc/test/fake_output_surface.h" | 18 #include "cc/test/fake_output_surface.h" |
21 #include "cc/test/fake_proxy.h" | 19 #include "cc/test/fake_proxy.h" |
22 #include "cc/test/fake_scrollbar_layer.h" | 20 #include "cc/test/fake_scrollbar_layer.h" |
23 #include "cc/test/geometry_test_utils.h" | 21 #include "cc/test/geometry_test_utils.h" |
24 #include "cc/test/layer_tree_test_common.h" | 22 #include "cc/test/layer_tree_test_common.h" |
| 23 #include "cc/resource_update_queue.h" |
25 #include "cc/test/occlusion_tracker_test_common.h" | 24 #include "cc/test/occlusion_tracker_test_common.h" |
26 #include "cc/thread_proxy.h" | |
27 #include "cc/timing_function.h" | 25 #include "cc/timing_function.h" |
28 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
29 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
30 #include "third_party/khronos/GLES2/gl2.h" | 28 #include "third_party/khronos/GLES2/gl2.h" |
31 #include "third_party/khronos/GLES2/gl2ext.h" | 29 #include "third_party/khronos/GLES2/gl2ext.h" |
32 #include "ui/gfx/point_conversions.h" | 30 #include "ui/gfx/point_conversions.h" |
33 #include "ui/gfx/size_conversions.h" | 31 #include "ui/gfx/size_conversions.h" |
34 #include "ui/gfx/vector2d_conversions.h" | 32 #include "ui/gfx/vector2d_conversions.h" |
35 | 33 |
36 namespace cc { | 34 namespace cc { |
(...skipping 1976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender
er); | 2011 FakeLayerImplTreeHostClient client(useSoftwareRendering, useDelegatingRender
er); |
2014 | 2012 |
2015 LayerTreeSettings settings; | 2013 LayerTreeSettings settings; |
2016 settings.maxPartialTextureUpdates = 4; | 2014 settings.maxPartialTextureUpdates = 4; |
2017 | 2015 |
2018 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); | 2016 scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, sc
oped_ptr<Thread>()); |
2019 EXPECT_TRUE(host->initializeRendererIfNeeded()); | 2017 EXPECT_TRUE(host->initializeRendererIfNeeded()); |
2020 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); | 2018 EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); |
2021 } | 2019 } |
2022 | 2020 |
2023 class LayerTreeHostTestMaxPendingFrames : public LayerTreeHostTest { | |
2024 public: | |
2025 LayerTreeHostTestMaxPendingFrames() | |
2026 : LayerTreeHostTest() | |
2027 { | |
2028 } | |
2029 | |
2030 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE | |
2031 { | |
2032 if (m_delegatingRenderer) | |
2033 return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>
(); | |
2034 return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); | |
2035 } | |
2036 | |
2037 virtual void beginTest() OVERRIDE | |
2038 { | |
2039 postSetNeedsCommitToMainThread(); | |
2040 } | |
2041 | |
2042 virtual void drawLayersOnThread(LayerTreeHostImpl* hostImpl) OVERRIDE | |
2043 { | |
2044 DCHECK(hostImpl->proxy()->hasImplThread()); | |
2045 | |
2046 const ThreadProxy* proxy = static_cast<ThreadProxy*>(hostImpl->proxy()); | |
2047 if (m_delegatingRenderer) | |
2048 EXPECT_EQ(1, proxy->maxFramesPendingForTesting()); | |
2049 else | |
2050 EXPECT_EQ(FrameRateController::kDefaultMaxFramesPending, proxy->maxF
ramesPendingForTesting()); | |
2051 endTest(); | |
2052 } | |
2053 | |
2054 virtual void afterTest() OVERRIDE | |
2055 { | |
2056 } | |
2057 | |
2058 protected: | |
2059 bool m_delegatingRenderer; | |
2060 }; | |
2061 | |
2062 TEST_F(LayerTreeHostTestMaxPendingFrames, DelegatingRenderer) | |
2063 { | |
2064 m_delegatingRenderer = true; | |
2065 runTest(true); | |
2066 } | |
2067 | |
2068 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) | |
2069 { | |
2070 m_delegatingRenderer = false; | |
2071 runTest(true); | |
2072 } | |
2073 | |
2074 } // namespace | 2021 } // namespace |
2075 } // namespace cc | 2022 } // namespace cc |
OLD | NEW |