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