| 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 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2369 private: | 2369 private: |
| 2370 NotificationClient client_; | 2370 NotificationClient client_; |
| 2371 }; | 2371 }; |
| 2372 | 2372 |
| 2373 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDNotification); | 2373 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDNotification); |
| 2374 | 2374 |
| 2375 // Verify that the BeginFrame notification is used to initiate rendering. | 2375 // Verify that the BeginFrame notification is used to initiate rendering. |
| 2376 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { | 2376 class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest { |
| 2377 public: | 2377 public: |
| 2378 void InitializeSettings(LayerTreeSettings* settings) override { | 2378 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2379 settings->begin_frame_scheduling_enabled = true; | 2379 settings->use_external_begin_frame_source = true; |
| 2380 } | 2380 } |
| 2381 | 2381 |
| 2382 void BeginTest() override { | 2382 void BeginTest() override { |
| 2383 // This will trigger a SetNeedsBeginFrame which will trigger a | 2383 // This will trigger a SetNeedsBeginFrame which will trigger a |
| 2384 // BeginFrame. | 2384 // BeginFrame. |
| 2385 PostSetNeedsCommitToMainThread(); | 2385 PostSetNeedsCommitToMainThread(); |
| 2386 } | 2386 } |
| 2387 | 2387 |
| 2388 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 2388 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 2389 LayerTreeHostImpl::FrameData* frame, | 2389 LayerTreeHostImpl::FrameData* frame, |
| 2390 DrawResult draw_result) override { | 2390 DrawResult draw_result) override { |
| 2391 EndTest(); | 2391 EndTest(); |
| 2392 return DRAW_SUCCESS; | 2392 return DRAW_SUCCESS; |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 void AfterTest() override {} | 2395 void AfterTest() override {} |
| 2396 | 2396 |
| 2397 private: | 2397 private: |
| 2398 base::TimeTicks frame_time_; | 2398 base::TimeTicks frame_time_; |
| 2399 }; | 2399 }; |
| 2400 | 2400 |
| 2401 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification); | 2401 MULTI_THREAD_TEST_F(LayerTreeHostTestBeginFrameNotification); |
| 2402 | 2402 |
| 2403 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled | 2403 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled |
| 2404 : public LayerTreeHostTest { | 2404 : public LayerTreeHostTest { |
| 2405 public: | 2405 public: |
| 2406 void InitializeSettings(LayerTreeSettings* settings) override { | 2406 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2407 settings->begin_frame_scheduling_enabled = true; | 2407 settings->use_external_begin_frame_source = true; |
| 2408 settings->using_synchronous_renderer_compositor = true; | 2408 settings->using_synchronous_renderer_compositor = true; |
| 2409 } | 2409 } |
| 2410 | 2410 |
| 2411 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2411 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2412 | 2412 |
| 2413 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 2413 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 2414 // The BeginFrame notification is turned off now but will get enabled | 2414 // The BeginFrame notification is turned off now but will get enabled |
| 2415 // once we return. End test while it's enabled. | 2415 // once we return. End test while it's enabled. |
| 2416 ImplThreadTaskRunner()->PostTask( | 2416 ImplThreadTaskRunner()->PostTask( |
| 2417 FROM_HERE, | 2417 FROM_HERE, |
| 2418 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, | 2418 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, |
| 2419 base::Unretained(this))); | 2419 base::Unretained(this))); |
| 2420 } | 2420 } |
| 2421 | 2421 |
| 2422 void AfterTest() override {} | 2422 void AfterTest() override {} |
| 2423 }; | 2423 }; |
| 2424 | 2424 |
| 2425 MULTI_THREAD_TEST_F( | 2425 MULTI_THREAD_TEST_F( |
| 2426 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); | 2426 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); |
| 2427 | 2427 |
| 2428 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { | 2428 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { |
| 2429 protected: | 2429 protected: |
| 2430 LayerTreeHostTestAbortedCommitDoesntStall() | 2430 LayerTreeHostTestAbortedCommitDoesntStall() |
| 2431 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} | 2431 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} |
| 2432 | 2432 |
| 2433 void InitializeSettings(LayerTreeSettings* settings) override { | 2433 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2434 settings->begin_frame_scheduling_enabled = true; | 2434 settings->use_external_begin_frame_source = true; |
| 2435 } | 2435 } |
| 2436 | 2436 |
| 2437 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2437 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2438 | 2438 |
| 2439 void DidCommit() override { | 2439 void DidCommit() override { |
| 2440 commit_count_++; | 2440 commit_count_++; |
| 2441 if (commit_count_ == 4) { | 2441 if (commit_count_ == 4) { |
| 2442 // After two aborted commits, request a real commit now to make sure a | 2442 // After two aborted commits, request a real commit now to make sure a |
| 2443 // real commit following an aborted commit will still complete and | 2443 // real commit following an aborted commit will still complete and |
| 2444 // end the test even when the Impl thread is idle. | 2444 // end the test even when the Impl thread is idle. |
| (...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5348 void AfterTest() override { | 5348 void AfterTest() override { |
| 5349 EXPECT_TRUE(deltas_sent_to_client_); | 5349 EXPECT_TRUE(deltas_sent_to_client_); |
| 5350 } | 5350 } |
| 5351 | 5351 |
| 5352 ScrollAndScaleSet info_; | 5352 ScrollAndScaleSet info_; |
| 5353 bool deltas_sent_to_client_; | 5353 bool deltas_sent_to_client_; |
| 5354 }; | 5354 }; |
| 5355 | 5355 |
| 5356 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); | 5356 MULTI_THREAD_TEST_F(LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer); |
| 5357 } // namespace cc | 5357 } // namespace cc |
| OLD | NEW |