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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 | 496 |
497 virtual void AfterTest() OVERRIDE {} | 497 virtual void AfterTest() OVERRIDE {} |
498 | 498 |
499 private: | 499 private: |
500 int num_commits_; | 500 int num_commits_; |
501 }; | 501 }; |
502 | 502 |
503 MULTI_THREAD_TEST_F( | 503 MULTI_THREAD_TEST_F( |
504 LayerTreeHostTestCompositeAndReadbackBeforePreviousCommitDraws); | 504 LayerTreeHostTestCompositeAndReadbackBeforePreviousCommitDraws); |
505 | 505 |
506 class LayerTreeHostTestCompositeAndReadbackDuringForcedDraw | |
507 : public LayerTreeHostTest { | |
508 protected: | |
509 LayerTreeHostTestCompositeAndReadbackDuringForcedDraw() | |
510 : prepare_to_draw_count_(0) {} | |
511 | |
512 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | |
513 // This enables forced draws after a single prepare to draw failure. | |
514 settings->timeout_and_draw_when_animation_checkerboards = true; | |
515 settings->maximum_number_of_failed_draws_before_draw_is_forced_ = 1; | |
516 } | |
517 | |
518 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | |
519 | |
520 virtual bool PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | |
521 LayerTreeHostImpl::FrameData* frame_data, | |
522 bool result) OVERRIDE { | |
523 prepare_to_draw_count_++; | |
524 EXPECT_LE(prepare_to_draw_count_, 3); | |
525 | |
526 // Before we react to the failed draw by initiating the forced draw | |
527 // sequence, start a readback on the main thread. | |
528 if (prepare_to_draw_count_ == | |
529 host_impl->settings() | |
530 .maximum_number_of_failed_draws_before_draw_is_forced_) { | |
531 PostReadbackToMainThread(); | |
532 } | |
533 | |
534 // Returning false will eventually result in a forced draw. | |
535 return false; | |
536 } | |
537 | |
538 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | |
539 // We should only draw for the readback and the forced draw. | |
540 EXPECT_GE(prepare_to_draw_count_, 2); | |
541 EXPECT_LE(prepare_to_draw_count_, 3); | |
542 } | |
543 | |
544 virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, | |
545 bool result) OVERRIDE { | |
546 // We should only swap for the forced draw. | |
547 EXPECT_EQ(prepare_to_draw_count_, 3); | |
brianderson
2013/09/04 21:34:39
This expectation fails with the delegated renderer
brianderson
2013/09/04 21:48:59
I looks like the delegating renderer cannot do a r
| |
548 EndTest(); | |
549 } | |
550 | |
551 virtual void AfterTest() OVERRIDE {} | |
552 | |
553 int prepare_to_draw_count_; | |
554 }; | |
555 | |
556 MULTI_THREAD_TEST_F(LayerTreeHostTestCompositeAndReadbackDuringForcedDraw); | |
557 | |
506 // If the layerTreeHost says it can't draw, Then we should not try to draw. | 558 // If the layerTreeHost says it can't draw, Then we should not try to draw. |
507 class LayerTreeHostTestCanDrawBlocksDrawing : public LayerTreeHostTest { | 559 class LayerTreeHostTestCanDrawBlocksDrawing : public LayerTreeHostTest { |
508 public: | 560 public: |
509 LayerTreeHostTestCanDrawBlocksDrawing() : num_commits_(0), done_(false) {} | 561 LayerTreeHostTestCanDrawBlocksDrawing() : num_commits_(0), done_(false) {} |
510 | 562 |
511 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } | 563 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } |
512 | 564 |
513 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 565 virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
514 if (done_) | 566 if (done_) |
515 return; | 567 return; |
(...skipping 3944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4460 int num_will_begin_frames_; | 4512 int num_will_begin_frames_; |
4461 int num_impl_commits_; | 4513 int num_impl_commits_; |
4462 }; | 4514 }; |
4463 | 4515 |
4464 // Commits can only be aborted when using the thread proxy. | 4516 // Commits can only be aborted when using the thread proxy. |
4465 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); | 4517 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortEvictedTextures); |
4466 | 4518 |
4467 } // namespace | 4519 } // namespace |
4468 | 4520 |
4469 } // namespace cc | 4521 } // namespace cc |
OLD | NEW |