| 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 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2224 private: | 2224 private: |
| 2225 NotificationClient client_; | 2225 NotificationClient client_; |
| 2226 }; | 2226 }; |
| 2227 | 2227 |
| 2228 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDNotification); | 2228 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDNotification); |
| 2229 | 2229 |
| 2230 // Verify that the BeginFrame notification is used to initiate rendering. | 2230 // Verify that the BeginFrame notification is used to initiate rendering. |
| 2231 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { | 2231 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { |
| 2232 public: | 2232 public: |
| 2233 void InitializeSettings(LayerTreeSettings* settings) override { | 2233 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2234 settings->begin_frame_scheduling_enabled = true; | 2234 settings->begin_frame_receiver = true; |
| 2235 } | 2235 } |
| 2236 | 2236 |
| 2237 void BeginTest() override { | 2237 void BeginTest() override { |
| 2238 // This will trigger a SetNeedsBeginFrame which will trigger a | 2238 // This will trigger a SetNeedsBeginFrame which will trigger a |
| 2239 // BeginFrame. | 2239 // BeginFrame. |
| 2240 PostSetNeedsCommitToMainThread(); | 2240 PostSetNeedsCommitToMainThread(); |
| 2241 } | 2241 } |
| 2242 | 2242 |
| 2243 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 2243 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 2244 LayerTreeHostImpl::FrameData* frame, | 2244 LayerTreeHostImpl::FrameData* frame, |
| 2245 DrawResult draw_result) override { | 2245 DrawResult draw_result) override { |
| 2246 EndTest(); | 2246 EndTest(); |
| 2247 return DRAW_SUCCESS; | 2247 return DRAW_SUCCESS; |
| 2248 } | 2248 } |
| 2249 | 2249 |
| 2250 void AfterTest() override {} | 2250 void AfterTest() override {} |
| 2251 | 2251 |
| 2252 private: | 2252 private: |
| 2253 base::TimeTicks frame_time_; | 2253 base::TimeTicks frame_time_; |
| 2254 }; | 2254 }; |
| 2255 | 2255 |
| 2256 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification); | 2256 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification); |
| 2257 | 2257 |
| 2258 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled | 2258 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled |
| 2259 : public LayerTreeHostTest { | 2259 : public LayerTreeHostTest { |
| 2260 public: | 2260 public: |
| 2261 void InitializeSettings(LayerTreeSettings* settings) override { | 2261 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2262 settings->begin_frame_scheduling_enabled = true; | 2262 settings->begin_frame_receiver = true; |
| 2263 settings->using_synchronous_renderer_compositor = true; | 2263 settings->using_synchronous_renderer_compositor = true; |
| 2264 } | 2264 } |
| 2265 | 2265 |
| 2266 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2266 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2267 | 2267 |
| 2268 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 2268 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 2269 // The BeginFrame notification is turned off now but will get enabled | 2269 // The BeginFrame notification is turned off now but will get enabled |
| 2270 // once we return. End test while it's enabled. | 2270 // once we return. End test while it's enabled. |
| 2271 ImplThreadTaskRunner()->PostTask( | 2271 ImplThreadTaskRunner()->PostTask( |
| 2272 FROM_HERE, | 2272 FROM_HERE, |
| 2273 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, | 2273 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, |
| 2274 base::Unretained(this))); | 2274 base::Unretained(this))); |
| 2275 } | 2275 } |
| 2276 | 2276 |
| 2277 void AfterTest() override {} | 2277 void AfterTest() override {} |
| 2278 }; | 2278 }; |
| 2279 | 2279 |
| 2280 MULTI_THREAD_TEST_F( | 2280 MULTI_THREAD_TEST_F( |
| 2281 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); | 2281 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); |
| 2282 | 2282 |
| 2283 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { | 2283 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { |
| 2284 protected: | 2284 protected: |
| 2285 LayerTreeHostTestAbortedCommitDoesntStall() | 2285 LayerTreeHostTestAbortedCommitDoesntStall() |
| 2286 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} | 2286 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} |
| 2287 | 2287 |
| 2288 void InitializeSettings(LayerTreeSettings* settings) override { | 2288 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2289 settings->begin_frame_scheduling_enabled = true; | 2289 settings->begin_frame_receiver = true; |
| 2290 } | 2290 } |
| 2291 | 2291 |
| 2292 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2292 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2293 | 2293 |
| 2294 void DidCommit() override { | 2294 void DidCommit() override { |
| 2295 commit_count_++; | 2295 commit_count_++; |
| 2296 if (commit_count_ == 4) { | 2296 if (commit_count_ == 4) { |
| 2297 // After two aborted commits, request a real commit now to make sure a | 2297 // After two aborted commits, request a real commit now to make sure a |
| 2298 // real commit following an aborted commit will still complete and | 2298 // real commit following an aborted commit will still complete and |
| 2299 // end the test even when the Impl thread is idle. | 2299 // end the test even when the Impl thread is idle. |
| (...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5203 void AfterTest() override { | 5203 void AfterTest() override { |
| 5204 EXPECT_TRUE(deltas_sent_to_client_); | 5204 EXPECT_TRUE(deltas_sent_to_client_); |
| 5205 } | 5205 } |
| 5206 | 5206 |
| 5207 ScrollAndScaleSet info_; | 5207 ScrollAndScaleSet info_; |
| 5208 bool deltas_sent_to_client_; | 5208 bool deltas_sent_to_client_; |
| 5209 }; | 5209 }; |
| 5210 | 5210 |
| 5211 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); | 5211 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); |
| 5212 } // namespace cc | 5212 } // namespace cc |
| OLD | NEW |