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" |
10 #include "cc/layer_impl.h" | 11 #include "cc/layer_impl.h" |
11 #include "cc/layer_tree_host_impl.h" | 12 #include "cc/layer_tree_host_impl.h" |
12 #include "cc/layer_tree_impl.h" | 13 #include "cc/layer_tree_impl.h" |
13 #include "cc/output_surface.h" | 14 #include "cc/output_surface.h" |
14 #include "cc/picture_layer.h" | 15 #include "cc/picture_layer.h" |
15 #include "cc/prioritized_resource.h" | 16 #include "cc/prioritized_resource.h" |
| 17 #include "cc/resource_update_queue.h" |
16 #include "cc/single_thread_proxy.h" | 18 #include "cc/single_thread_proxy.h" |
17 #include "cc/test/fake_content_layer.h" | 19 #include "cc/test/fake_content_layer.h" |
18 #include "cc/test/fake_content_layer_client.h" | 20 #include "cc/test/fake_content_layer_client.h" |
19 #include "cc/test/fake_layer_tree_host_client.h" | 21 #include "cc/test/fake_layer_tree_host_client.h" |
20 #include "cc/test/fake_output_surface.h" | 22 #include "cc/test/fake_output_surface.h" |
21 #include "cc/test/fake_proxy.h" | 23 #include "cc/test/fake_proxy.h" |
22 #include "cc/test/fake_scrollbar_layer.h" | 24 #include "cc/test/fake_scrollbar_layer.h" |
23 #include "cc/test/geometry_test_utils.h" | 25 #include "cc/test/geometry_test_utils.h" |
24 #include "cc/test/layer_tree_test_common.h" | 26 #include "cc/test/layer_tree_test_common.h" |
25 #include "cc/resource_update_queue.h" | |
26 #include "cc/test/occlusion_tracker_test_common.h" | 27 #include "cc/test/occlusion_tracker_test_common.h" |
| 28 #include "cc/thread_proxy.h" |
27 #include "cc/timing_function.h" | 29 #include "cc/timing_function.h" |
28 #include "skia/ext/refptr.h" | 30 #include "skia/ext/refptr.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 32 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
31 #include "third_party/khronos/GLES2/gl2.h" | 33 #include "third_party/khronos/GLES2/gl2.h" |
32 #include "third_party/khronos/GLES2/gl2ext.h" | 34 #include "third_party/khronos/GLES2/gl2ext.h" |
33 #include "third_party/skia/include/core/SkPicture.h" | 35 #include "third_party/skia/include/core/SkPicture.h" |
34 #include "ui/gfx/point_conversions.h" | 36 #include "ui/gfx/point_conversions.h" |
35 #include "ui/gfx/size_conversions.h" | 37 #include "ui/gfx/size_conversions.h" |
36 #include "ui/gfx/vector2d_conversions.h" | 38 #include "ui/gfx/vector2d_conversions.h" |
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2081 | 2083 |
2082 private: | 2084 private: |
2083 gfx::Size m_bounds; | 2085 gfx::Size m_bounds; |
2084 FillRectContentLayerClient m_contentClient; | 2086 FillRectContentLayerClient m_contentClient; |
2085 scoped_refptr<PictureLayer> m_layer; | 2087 scoped_refptr<PictureLayer> m_layer; |
2086 skia::RefPtr<SkPicture> m_picture; | 2088 skia::RefPtr<SkPicture> m_picture; |
2087 }; | 2089 }; |
2088 | 2090 |
2089 MULTI_THREAD_TEST_F(LayerTreeHostTestCapturePicture); | 2091 MULTI_THREAD_TEST_F(LayerTreeHostTestCapturePicture); |
2090 | 2092 |
| 2093 class LayerTreeHostTestMaxPendingFrames : public LayerTreeHostTest { |
| 2094 public: |
| 2095 LayerTreeHostTestMaxPendingFrames() |
| 2096 : LayerTreeHostTest() |
| 2097 { |
| 2098 } |
| 2099 |
| 2100 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE |
| 2101 { |
| 2102 if (m_delegatingRenderer) |
| 2103 return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>
(); |
| 2104 return FakeOutputSurface::Create3d().PassAs<OutputSurface>(); |
| 2105 } |
| 2106 |
| 2107 virtual void beginTest() OVERRIDE |
| 2108 { |
| 2109 postSetNeedsCommitToMainThread(); |
| 2110 } |
| 2111 |
| 2112 virtual void drawLayersOnThread(LayerTreeHostImpl* hostImpl) OVERRIDE |
| 2113 { |
| 2114 DCHECK(hostImpl->proxy()->hasImplThread()); |
| 2115 |
| 2116 const ThreadProxy* proxy = static_cast<ThreadProxy*>(hostImpl->proxy()); |
| 2117 if (m_delegatingRenderer) |
| 2118 EXPECT_EQ(1, proxy->maxFramesPendingForTesting()); |
| 2119 else |
| 2120 EXPECT_EQ(FrameRateController::kDefaultMaxFramesPending, proxy->maxF
ramesPendingForTesting()); |
| 2121 endTest(); |
| 2122 } |
| 2123 |
| 2124 virtual void afterTest() OVERRIDE |
| 2125 { |
| 2126 } |
| 2127 |
| 2128 protected: |
| 2129 bool m_delegatingRenderer; |
| 2130 }; |
| 2131 |
| 2132 TEST_F(LayerTreeHostTestMaxPendingFrames, DelegatingRenderer) |
| 2133 { |
| 2134 m_delegatingRenderer = true; |
| 2135 runTest(true); |
| 2136 } |
| 2137 |
| 2138 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) |
| 2139 { |
| 2140 m_delegatingRenderer = false; |
| 2141 runTest(true); |
| 2142 } |
| 2143 |
2091 } // namespace | 2144 } // namespace |
2092 } // namespace cc | 2145 } // namespace cc |
OLD | NEW |