| 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/frame_rate_controller.h" |
| (...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 m_delegatingRenderer = true; | 2097 m_delegatingRenderer = true; |
| 2098 runTest(true); | 2098 runTest(true); |
| 2099 } | 2099 } |
| 2100 | 2100 |
| 2101 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) | 2101 TEST_F(LayerTreeHostTestMaxPendingFrames, GLRenderer) |
| 2102 { | 2102 { |
| 2103 m_delegatingRenderer = false; | 2103 m_delegatingRenderer = false; |
| 2104 runTest(true); | 2104 runTest(true); |
| 2105 } | 2105 } |
| 2106 | 2106 |
| 2107 // Verify that the vsync notification is used to initiate rendering. |
| 2108 class LayerTreeHostTestVSyncNotification : public LayerTreeHostTest { |
| 2109 public: |
| 2110 LayerTreeHostTestVSyncNotification() |
| 2111 { |
| 2112 m_settings.renderVSyncNotificationEnabled = true; |
| 2113 } |
| 2114 |
| 2115 virtual void beginTest() OVERRIDE |
| 2116 { |
| 2117 postSetNeedsCommitToMainThread(); |
| 2118 } |
| 2119 |
| 2120 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE |
| 2121 { |
| 2122 FakeOutputSurface* fakeOutputSurface = |
| 2123 reinterpret_cast<FakeOutputSurface*>(impl->outputSurface()); |
| 2124 |
| 2125 // The vsync notification is turned off now but will get enabled once we |
| 2126 // return, so post a task to trigger it. |
| 2127 ASSERT_FALSE(fakeOutputSurface->vsync_notification_enabled()); |
| 2128 postVSyncOnImplThread(fakeOutputSurface); |
| 2129 } |
| 2130 |
| 2131 void postVSyncOnImplThread(FakeOutputSurface* fakeOutputSurface) |
| 2132 { |
| 2133 DCHECK(implThread()); |
| 2134 implThread()->postTask(base::Bind(&LayerTreeHostTestVSyncNotification::D
idVSync, |
| 2135 base::Unretained(this), base::Unretained(fakeOutp
utSurface))); |
| 2136 } |
| 2137 |
| 2138 void DidVSync(FakeOutputSurface* fakeOutputSurface) |
| 2139 { |
| 2140 ASSERT_TRUE(fakeOutputSurface->vsync_notification_enabled()); |
| 2141 fakeOutputSurface->DidVSync(m_frameTime); |
| 2142 } |
| 2143 |
| 2144 virtual bool prepareToDrawOnThread(LayerTreeHostImpl*, LayerTreeHostImpl::Fr
ameData&, bool result) OVERRIDE |
| 2145 { |
| 2146 endTest(); |
| 2147 return true; |
| 2148 } |
| 2149 |
| 2150 virtual void afterTest() OVERRIDE |
| 2151 { |
| 2152 } |
| 2153 |
| 2154 private: |
| 2155 base::TimeTicks m_frameTime; |
| 2156 }; |
| 2157 |
| 2158 MULTI_THREAD_TEST_F(LayerTreeHostTestVSyncNotification); |
| 2159 |
| 2107 } // namespace | 2160 } // namespace |
| 2108 } // namespace cc | 2161 } // namespace cc |
| OLD | NEW |