| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "cc/layers/heads_up_display_layer.h" | 9 #include "cc/layers/heads_up_display_layer.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| 11 #include "cc/layers/painted_scrollbar_layer.h" | 11 #include "cc/layers/painted_scrollbar_layer.h" |
| 12 #include "cc/layers/picture_layer.h" | 12 #include "cc/layers/picture_layer.h" |
| 13 #include "cc/layers/texture_layer.h" | 13 #include "cc/layers/texture_layer.h" |
| 14 #include "cc/layers/texture_layer_impl.h" | 14 #include "cc/layers/texture_layer_impl.h" |
| 15 #include "cc/layers/video_layer.h" | 15 #include "cc/layers/video_layer.h" |
| 16 #include "cc/layers/video_layer_impl.h" | 16 #include "cc/layers/video_layer_impl.h" |
| 17 #include "cc/output/filter_operations.h" | 17 #include "cc/output/filter_operations.h" |
| 18 #include "cc/resources/single_release_callback.h" | 18 #include "cc/resources/single_release_callback.h" |
| 19 #include "cc/test/failure_output_surface.h" | |
| 20 #include "cc/test/fake_content_layer_client.h" | 19 #include "cc/test/fake_content_layer_client.h" |
| 21 #include "cc/test/fake_layer_tree_host_client.h" | 20 #include "cc/test/fake_layer_tree_host_client.h" |
| 22 #include "cc/test/fake_output_surface.h" | 21 #include "cc/test/fake_output_surface.h" |
| 23 #include "cc/test/fake_output_surface_client.h" | 22 #include "cc/test/fake_output_surface_client.h" |
| 24 #include "cc/test/fake_painted_scrollbar_layer.h" | 23 #include "cc/test/fake_painted_scrollbar_layer.h" |
| 25 #include "cc/test/fake_picture_layer.h" | 24 #include "cc/test/fake_picture_layer.h" |
| 26 #include "cc/test/fake_picture_layer_impl.h" | 25 #include "cc/test/fake_picture_layer_impl.h" |
| 27 #include "cc/test/fake_resource_provider.h" | 26 #include "cc/test/fake_resource_provider.h" |
| 28 #include "cc/test/fake_scoped_ui_resource.h" | 27 #include "cc/test/fake_scoped_ui_resource.h" |
| 29 #include "cc/test/fake_scrollbar.h" | 28 #include "cc/test/fake_scrollbar.h" |
| 30 #include "cc/test/fake_video_frame_provider.h" | 29 #include "cc/test/fake_video_frame_provider.h" |
| 31 #include "cc/test/layer_tree_test.h" | 30 #include "cc/test/layer_tree_test.h" |
| 32 #include "cc/test/render_pass_test_utils.h" | 31 #include "cc/test/render_pass_test_utils.h" |
| 33 #include "cc/test/test_context_provider.h" | 32 #include "cc/test/test_context_provider.h" |
| 33 #include "cc/test/test_delegating_output_surface.h" |
| 34 #include "cc/test/test_shared_bitmap_manager.h" | 34 #include "cc/test/test_shared_bitmap_manager.h" |
| 35 #include "cc/test/test_web_graphics_context_3d.h" | 35 #include "cc/test/test_web_graphics_context_3d.h" |
| 36 #include "cc/trees/layer_tree_host.h" | 36 #include "cc/trees/layer_tree_host.h" |
| 37 #include "cc/trees/layer_tree_host_impl.h" | 37 #include "cc/trees/layer_tree_host_impl.h" |
| 38 #include "cc/trees/layer_tree_impl.h" | 38 #include "cc/trees/layer_tree_impl.h" |
| 39 #include "cc/trees/single_thread_proxy.h" | 39 #include "cc/trees/single_thread_proxy.h" |
| 40 #include "gpu/GLES2/gl2extchromium.h" | 40 #include "gpu/GLES2/gl2extchromium.h" |
| 41 #include "media/base/media.h" | 41 #include "media/base/media.h" |
| 42 | 42 |
| 43 using media::VideoFrame; | 43 using media::VideoFrame; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 73 CHECK(context3d_); | 73 CHECK(context3d_); |
| 74 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 74 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 75 GL_INNOCENT_CONTEXT_RESET_ARB); | 75 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 76 context3d_ = NULL; | 76 context3d_ = NULL; |
| 77 } | 77 } |
| 78 | 78 |
| 79 virtual std::unique_ptr<TestWebGraphicsContext3D> CreateContext3d() { | 79 virtual std::unique_ptr<TestWebGraphicsContext3D> CreateContext3d() { |
| 80 return TestWebGraphicsContext3D::Create(); | 80 return TestWebGraphicsContext3D::Create(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 std::unique_ptr<OutputSurface> CreateOutputSurface() override { | 83 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( |
| 84 scoped_refptr<ContextProvider> compositor_context_provider, |
| 85 scoped_refptr<ContextProvider> worker_context_provider) override { |
| 84 if (times_to_fail_create_) { | 86 if (times_to_fail_create_) { |
| 85 --times_to_fail_create_; | 87 --times_to_fail_create_; |
| 86 ExpectCreateToFail(); | 88 ExpectCreateToFail(); |
| 87 return base::WrapUnique(new FailureOutputSurface(delegating_renderer())); | 89 auto test_compositor_context_provider = TestContextProvider::Create(); |
| 90 test_compositor_context_provider->UnboundTestContext3d() |
| 91 ->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 92 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 93 compositor_context_provider = std::move(test_compositor_context_provider); |
| 94 } |
| 95 return LayerTreeTest::CreateDelegatingOutputSurface( |
| 96 std::move(compositor_context_provider), |
| 97 std::move(worker_context_provider)); |
| 98 } |
| 99 |
| 100 std::unique_ptr<OutputSurface> CreateDisplayOutputSurface( |
| 101 scoped_refptr<ContextProvider> compositor_context_provider) override { |
| 102 std::unique_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); |
| 103 if (context_should_support_io_surface_) { |
| 104 context3d->set_have_extension_io_surface(true); |
| 105 context3d->set_have_extension_egl_image(true); |
| 88 } | 106 } |
| 89 | 107 |
| 90 std::unique_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); | |
| 91 base::AutoLock lock(context3d_lock_); | 108 base::AutoLock lock(context3d_lock_); |
| 92 context3d_ = context3d.get(); | 109 context3d_ = context3d.get(); |
| 93 | 110 return LayerTreeTest::CreateDisplayOutputSurface( |
| 94 if (context_should_support_io_surface_) { | 111 TestContextProvider::Create(std::move(context3d))); |
| 95 context3d_->set_have_extension_io_surface(true); | |
| 96 context3d_->set_have_extension_egl_image(true); | |
| 97 } | |
| 98 | |
| 99 DCHECK(delegating_renderer()); | |
| 100 return FakeOutputSurface::CreateDelegating3d(std::move(context3d)); | |
| 101 } | 112 } |
| 102 | 113 |
| 103 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 114 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 104 LayerTreeHostImpl::FrameData* frame, | 115 LayerTreeHostImpl::FrameData* frame, |
| 105 DrawResult draw_result) override { | 116 DrawResult draw_result) override { |
| 106 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { | 117 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { |
| 107 // Only valid for single-threaded compositing, which activates | 118 // Only valid for single-threaded compositing, which activates |
| 108 // immediately and will try to draw again when content has finished. | 119 // immediately and will try to draw again when content has finished. |
| 109 DCHECK(!host_impl->task_runner_provider()->HasImplThread()); | 120 DCHECK(!host_impl->task_runner_provider()->HasImplThread()); |
| 110 return draw_result; | 121 return draw_result; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 num_losses_last_test_case_(-1), | 182 num_losses_last_test_case_(-1), |
| 172 recovered_context_(true), | 183 recovered_context_(true), |
| 173 first_initialized_(false) {} | 184 first_initialized_(false) {} |
| 174 | 185 |
| 175 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 186 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 176 | 187 |
| 177 void RequestNewOutputSurface() override { | 188 void RequestNewOutputSurface() override { |
| 178 if (async_output_surface_creation_) { | 189 if (async_output_surface_creation_) { |
| 179 MainThreadTaskRunner()->PostTask( | 190 MainThreadTaskRunner()->PostTask( |
| 180 FROM_HERE, base::Bind(&LayerTreeHostContextTestLostContextSucceeds:: | 191 FROM_HERE, base::Bind(&LayerTreeHostContextTestLostContextSucceeds:: |
| 181 CreateAndSetOutputSurface, | 192 AsyncRequestNewOutputSurface, |
| 182 base::Unretained(this))); | 193 base::Unretained(this))); |
| 183 } else { | 194 } else { |
| 184 CreateAndSetOutputSurface(); | 195 AsyncRequestNewOutputSurface(); |
| 185 } | 196 } |
| 186 } | 197 } |
| 187 | 198 |
| 188 void CreateAndSetOutputSurface() { | 199 void AsyncRequestNewOutputSurface() { |
| 189 std::unique_ptr<OutputSurface> surface( | 200 LayerTreeHostContextTest::RequestNewOutputSurface(); |
| 190 LayerTreeHostContextTest::CreateOutputSurface()); | |
| 191 CHECK(surface); | |
| 192 layer_tree_host()->SetOutputSurface(std::move(surface)); | |
| 193 } | 201 } |
| 194 | 202 |
| 195 void DidInitializeOutputSurface() override { | 203 void DidInitializeOutputSurface() override { |
| 196 if (first_initialized_) | 204 if (first_initialized_) |
| 197 ++num_losses_; | 205 ++num_losses_; |
| 198 else | 206 else |
| 199 first_initialized_ = true; | 207 first_initialized_ = true; |
| 200 | 208 |
| 201 recovered_context_ = true; | 209 recovered_context_ = true; |
| 202 } | 210 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 void WillBeginTest() override { | 366 void WillBeginTest() override { |
| 359 // Override to not become visible. | 367 // Override to not become visible. |
| 360 DCHECK(!layer_tree_host()->visible()); | 368 DCHECK(!layer_tree_host()->visible()); |
| 361 } | 369 } |
| 362 | 370 |
| 363 void BeginTest() override { | 371 void BeginTest() override { |
| 364 PostSetNeedsCommitToMainThread(); | 372 PostSetNeedsCommitToMainThread(); |
| 365 EndTest(); | 373 EndTest(); |
| 366 } | 374 } |
| 367 | 375 |
| 368 std::unique_ptr<OutputSurface> CreateOutputSurface() override { | 376 void RequestNewOutputSurface() override { |
| 369 EXPECT_TRUE(false); | 377 ADD_FAILURE() << "RequestNewOutputSurface() should not be called"; |
| 370 return nullptr; | |
| 371 } | 378 } |
| 372 | 379 |
| 373 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 380 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
| 374 | 381 |
| 375 void AfterTest() override {} | 382 void AfterTest() override {} |
| 376 }; | 383 }; |
| 377 | 384 |
| 378 SINGLE_AND_MULTI_THREAD_TEST_F( | 385 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 379 LayerTreeHostClientNotVisibleDoesNotCreateOutputSurface); | 386 LayerTreeHostClientNotVisibleDoesNotCreateOutputSurface); |
| 380 | 387 |
| 381 // This tests the OutputSurface release logic in the following sequence. | 388 // This tests the OutputSurface release logic in the following sequence. |
| 382 // SetUp LTH and create and init OutputSurface | 389 // SetUp LTH and create and init OutputSurface |
| 383 // LTH::SetVisible(false); | 390 // LTH::SetVisible(false); |
| 384 // LTH::ReleaseOutputSurface(); | 391 // LTH::ReleaseOutputSurface(); |
| 385 // ... | 392 // ... |
| 386 // LTH::SetVisible(true); | 393 // LTH::SetVisible(true); |
| 387 // Create and init new OutputSurface | 394 // Create and init new OutputSurface |
| 388 class LayerTreeHostClientTakeAwayOutputSurface | 395 class LayerTreeHostClientTakeAwayOutputSurface |
| 389 : public LayerTreeHostContextTest { | 396 : public LayerTreeHostContextTest { |
| 390 public: | 397 public: |
| 391 LayerTreeHostClientTakeAwayOutputSurface() | 398 LayerTreeHostClientTakeAwayOutputSurface() |
| 392 : LayerTreeHostContextTest(), setos_counter_(0) {} | 399 : LayerTreeHostContextTest(), setos_counter_(0) {} |
| 393 | 400 |
| 394 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 401 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 395 | 402 |
| 396 void RequestNewOutputSurface() override { | 403 void RequestNewOutputSurface() override { |
| 397 if (layer_tree_host()->visible()) | 404 if (layer_tree_host()->visible()) { |
| 398 CreateAndSetOutputSurface(); | 405 setos_counter_++; |
| 399 } | 406 LayerTreeHostContextTest::RequestNewOutputSurface(); |
| 400 | 407 } |
| 401 void CreateAndSetOutputSurface() { | |
| 402 std::unique_ptr<OutputSurface> surface = | |
| 403 LayerTreeHostContextTest::CreateOutputSurface(); | |
| 404 CHECK(surface); | |
| 405 setos_counter_++; | |
| 406 layer_tree_host()->SetOutputSurface(std::move(surface)); | |
| 407 } | 408 } |
| 408 | 409 |
| 409 void HideAndReleaseOutputSurface() { | 410 void HideAndReleaseOutputSurface() { |
| 410 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); | 411 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); |
| 411 layer_tree_host()->SetVisible(false); | 412 layer_tree_host()->SetVisible(false); |
| 412 std::unique_ptr<OutputSurface> surface = | 413 std::unique_ptr<OutputSurface> surface = |
| 413 layer_tree_host()->ReleaseOutputSurface(); | 414 layer_tree_host()->ReleaseOutputSurface(); |
| 414 CHECK(surface); | 415 CHECK(surface); |
| 415 MainThreadTaskRunner()->PostTask( | 416 MainThreadTaskRunner()->PostTask( |
| 416 FROM_HERE, | 417 FROM_HERE, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 void RequestNewOutputSurface() override { | 457 void RequestNewOutputSurface() override { |
| 457 EXPECT_GE(1, ++request_count_); | 458 EXPECT_GE(1, ++request_count_); |
| 458 EndTest(); | 459 EndTest(); |
| 459 } | 460 } |
| 460 | 461 |
| 461 void BeginTest() override { | 462 void BeginTest() override { |
| 462 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 463 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 463 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); | 464 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); |
| 464 } | 465 } |
| 465 | 466 |
| 466 std::unique_ptr<OutputSurface> CreateOutputSurface() override { | |
| 467 EXPECT_TRUE(false); | |
| 468 return nullptr; | |
| 469 } | |
| 470 | |
| 471 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } | 467 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } |
| 472 | 468 |
| 473 void AfterTest() override {} | 469 void AfterTest() override {} |
| 474 | 470 |
| 475 int request_count_; | 471 int request_count_; |
| 476 }; | 472 }; |
| 477 | 473 |
| 478 // This test uses Composite() which only exists for single thread. | 474 // This test uses Composite() which only exists for single thread. |
| 479 SINGLE_THREAD_TEST_F(MultipleCompositeDoesNotCreateOutputSurface); | 475 SINGLE_THREAD_TEST_F(MultipleCompositeDoesNotCreateOutputSurface); |
| 480 | 476 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 493 } | 489 } |
| 494 | 490 |
| 495 void RequestNewOutputSurface() override { | 491 void RequestNewOutputSurface() override { |
| 496 num_requests_++; | 492 num_requests_++; |
| 497 // There should be one initial request and then one request from | 493 // There should be one initial request and then one request from |
| 498 // the LayerTreeTest test hooks DidFailToInitializeOutputSurface (which is | 494 // the LayerTreeTest test hooks DidFailToInitializeOutputSurface (which is |
| 499 // hard to skip). This second request is just ignored and is test cruft. | 495 // hard to skip). This second request is just ignored and is test cruft. |
| 500 EXPECT_LE(num_requests_, 2); | 496 EXPECT_LE(num_requests_, 2); |
| 501 if (num_requests_ > 1) | 497 if (num_requests_ > 1) |
| 502 return; | 498 return; |
| 499 LayerTreeHostContextTest::RequestNewOutputSurface(); |
| 500 } |
| 501 |
| 502 std::unique_ptr<TestDelegatingOutputSurface> CreateDelegatingOutputSurface( |
| 503 scoped_refptr<ContextProvider> compositor_context_provider, |
| 504 scoped_refptr<ContextProvider> worker_context_provider) override { |
| 503 ExpectCreateToFail(); | 505 ExpectCreateToFail(); |
| 504 layer_tree_host()->SetOutputSurface( | 506 auto test_compositor_context_provider = TestContextProvider::Create(); |
| 505 base::WrapUnique(new FailureOutputSurface(false))); | 507 test_compositor_context_provider->UnboundTestContext3d() |
| 508 ->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 509 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 510 return LayerTreeTest::CreateDelegatingOutputSurface( |
| 511 std::move(test_compositor_context_provider), |
| 512 std::move(worker_context_provider)); |
| 506 } | 513 } |
| 507 | 514 |
| 508 void BeginTest() override { | 515 void BeginTest() override { |
| 509 // First composite tries to create a surface. | 516 // First composite tries to create a surface. |
| 510 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 517 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 511 EXPECT_EQ(num_requests_, 2); | 518 EXPECT_EQ(num_requests_, 2); |
| 512 EXPECT_TRUE(has_failed_); | 519 EXPECT_TRUE(has_failed_); |
| 513 | 520 |
| 514 // Second composite should not request or fail. | 521 // Second composite should not request or fail. |
| 515 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); | 522 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(2)); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 void RequestNewOutputSurface() override { | 555 void RequestNewOutputSurface() override { |
| 549 MainThreadTaskRunner()->PostTask( | 556 MainThreadTaskRunner()->PostTask( |
| 550 FROM_HERE, | 557 FROM_HERE, |
| 551 base::Bind(&LayerTreeHostContextTestCommitAfterDelayedOutputSurface:: | 558 base::Bind(&LayerTreeHostContextTestCommitAfterDelayedOutputSurface:: |
| 552 CreateAndSetOutputSurface, | 559 CreateAndSetOutputSurface, |
| 553 base::Unretained(this))); | 560 base::Unretained(this))); |
| 554 } | 561 } |
| 555 | 562 |
| 556 void CreateAndSetOutputSurface() { | 563 void CreateAndSetOutputSurface() { |
| 557 creating_output_ = true; | 564 creating_output_ = true; |
| 558 layer_tree_host()->SetOutputSurface( | 565 LayerTreeHostContextTest::RequestNewOutputSurface(); |
| 559 LayerTreeHostContextTest::CreateOutputSurface()); | |
| 560 } | 566 } |
| 561 | 567 |
| 562 void BeginTest() override { | 568 void BeginTest() override { |
| 563 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 569 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 564 } | 570 } |
| 565 | 571 |
| 566 void ScheduleComposite() override { | 572 void ScheduleComposite() override { |
| 567 if (creating_output_) | 573 if (creating_output_) |
| 568 EndTest(); | 574 EndTest(); |
| 569 } | 575 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 581 public: | 587 public: |
| 582 LayerTreeHostContextTestAvoidUnnecessaryComposite() | 588 LayerTreeHostContextTestAvoidUnnecessaryComposite() |
| 583 : LayerTreeHostContextTest(), in_composite_(false) {} | 589 : LayerTreeHostContextTest(), in_composite_(false) {} |
| 584 | 590 |
| 585 void InitializeSettings(LayerTreeSettings* settings) override { | 591 void InitializeSettings(LayerTreeSettings* settings) override { |
| 586 settings->single_thread_proxy_scheduler = false; | 592 settings->single_thread_proxy_scheduler = false; |
| 587 settings->use_zero_copy = true; | 593 settings->use_zero_copy = true; |
| 588 } | 594 } |
| 589 | 595 |
| 590 void RequestNewOutputSurface() override { | 596 void RequestNewOutputSurface() override { |
| 591 layer_tree_host()->SetOutputSurface( | 597 LayerTreeHostContextTest::RequestNewOutputSurface(); |
| 592 LayerTreeHostContextTest::CreateOutputSurface()); | |
| 593 EndTest(); | 598 EndTest(); |
| 594 } | 599 } |
| 595 | 600 |
| 596 void BeginTest() override { | 601 void BeginTest() override { |
| 597 in_composite_ = true; | 602 in_composite_ = true; |
| 598 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); | 603 layer_tree_host()->Composite(base::TimeTicks::FromInternalValue(1)); |
| 599 in_composite_ = false; | 604 in_composite_ = false; |
| 600 } | 605 } |
| 601 | 606 |
| 602 void ScheduleComposite() override { EXPECT_FALSE(in_composite_); } | 607 void ScheduleComposite() override { EXPECT_FALSE(in_composite_); } |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 LayerTreeHostImpl::FrameData* frame, | 1034 LayerTreeHostImpl::FrameData* frame, |
| 1030 DrawResult draw_result) override { | 1035 DrawResult draw_result) override { |
| 1031 if (host_impl->active_tree()->source_frame_number() == 2) { | 1036 if (host_impl->active_tree()->source_frame_number() == 2) { |
| 1032 // Lose the context during draw on the second commit. This will cause | 1037 // Lose the context during draw on the second commit. This will cause |
| 1033 // a third commit to recover. | 1038 // a third commit to recover. |
| 1034 context3d_->set_times_bind_texture_succeeds(0); | 1039 context3d_->set_times_bind_texture_succeeds(0); |
| 1035 } | 1040 } |
| 1036 return draw_result; | 1041 return draw_result; |
| 1037 } | 1042 } |
| 1038 | 1043 |
| 1039 std::unique_ptr<OutputSurface> CreateOutputSurface() override { | 1044 void RequestNewOutputSurface() override { |
| 1040 // This will get called twice: | 1045 // This will get called twice: |
| 1041 // First when we create the initial output surface... | 1046 // First when we create the initial output surface... |
| 1042 if (layer_tree_host()->source_frame_number() > 0) { | 1047 if (layer_tree_host()->source_frame_number() > 0) { |
| 1043 // ... and then again after we forced the context to be lost. | 1048 // ... and then again after we forced the context to be lost. |
| 1044 lost_context_ = true; | 1049 lost_context_ = true; |
| 1045 } | 1050 } |
| 1046 return LayerTreeHostContextTest::CreateOutputSurface(); | 1051 LayerTreeHostContextTest::RequestNewOutputSurface(); |
| 1047 } | 1052 } |
| 1048 | 1053 |
| 1049 void DidCommitAndDrawFrame() override { | 1054 void DidCommitAndDrawFrame() override { |
| 1050 ASSERT_TRUE(layer_tree_host()->hud_layer()); | 1055 ASSERT_TRUE(layer_tree_host()->hud_layer()); |
| 1051 // End the test once we know the 3nd frame drew. | 1056 // End the test once we know the 3nd frame drew. |
| 1052 if (layer_tree_host()->source_frame_number() < 5) { | 1057 if (layer_tree_host()->source_frame_number() < 5) { |
| 1053 layer_tree_host()->root_layer()->SetNeedsDisplay(); | 1058 layer_tree_host()->root_layer()->SetNeedsDisplay(); |
| 1054 layer_tree_host()->SetNeedsCommit(); | 1059 layer_tree_host()->SetNeedsCommit(); |
| 1055 } else { | 1060 } else { |
| 1056 EndTest(); | 1061 EndTest(); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 void AfterTest() override {} | 1578 void AfterTest() override {} |
| 1574 | 1579 |
| 1575 bool deferred_; | 1580 bool deferred_; |
| 1576 }; | 1581 }; |
| 1577 | 1582 |
| 1578 SINGLE_AND_MULTI_THREAD_TEST_F( | 1583 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1579 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1584 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
| 1580 | 1585 |
| 1581 } // namespace | 1586 } // namespace |
| 1582 } // namespace cc | 1587 } // namespace cc |
| OLD | NEW |