| 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 "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
| 9 #include "cc/heads_up_display_layer.h" | 9 #include "cc/heads_up_display_layer.h" |
| 10 #include "cc/io_surface_layer.h" | 10 #include "cc/io_surface_layer.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 if (!offscreen_contexts_compositor_thread_ || | 142 if (!offscreen_contexts_compositor_thread_ || |
| 143 offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) { | 143 offscreen_contexts_compositor_thread_->DestroyedOnMainThread()) { |
| 144 offscreen_contexts_compositor_thread_ = new FakeContextProvider( | 144 offscreen_contexts_compositor_thread_ = new FakeContextProvider( |
| 145 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, | 145 base::Bind(&LayerTreeHostContextTest::CreateOffscreenContext3d, |
| 146 base::Unretained(this))); | 146 base::Unretained(this))); |
| 147 } | 147 } |
| 148 return offscreen_contexts_compositor_thread_; | 148 return offscreen_contexts_compositor_thread_; |
| 149 } | 149 } |
| 150 | 150 |
| 151 virtual bool prepareToDrawOnThread( | 151 virtual bool prepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 152 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result) | 152 LayerTreeHostImpl::FrameData* frame, |
| 153 bool result) |
| 153 OVERRIDE { | 154 OVERRIDE { |
| 154 EXPECT_TRUE(result); | 155 EXPECT_TRUE(result); |
| 155 if (!times_to_lose_during_draw_) | 156 if (!times_to_lose_during_draw_) |
| 156 return result; | 157 return result; |
| 157 | 158 |
| 158 --times_to_lose_during_draw_; | 159 --times_to_lose_during_draw_; |
| 159 context3d_->set_times_make_current_succeeds(0); | 160 context3d_->set_times_make_current_succeeds(0); |
| 160 | 161 |
| 161 times_to_fail_create_ = times_to_fail_recreate_; | 162 times_to_fail_create_ = times_to_fail_recreate_; |
| 162 times_to_fail_recreate_ = 0; | 163 times_to_fail_recreate_ = 0; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { | 417 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { |
| 417 // Invalidate the render surface so we don't try to use a cached copy of the | 418 // Invalidate the render surface so we don't try to use a cached copy of the |
| 418 // surface. We want to make sure to test the drawing paths for drawing to | 419 // surface. We want to make sure to test the drawing paths for drawing to |
| 419 // a child surface. | 420 // a child surface. |
| 420 content_->SetNeedsDisplay(); | 421 content_->SetNeedsDisplay(); |
| 421 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); | 422 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); |
| 422 } | 423 } |
| 423 | 424 |
| 424 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 425 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 425 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( | 426 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( |
| 426 host_impl->rootLayer()->children()[0]); | 427 host_impl->active_tree()->root_layer()->children()[0]); |
| 427 // Even though the context was lost, we should have a resource. The | 428 // Even though the context was lost, we should have a resource. The |
| 428 // TestWebGraphicsContext3D ensures that this resource is created with | 429 // TestWebGraphicsContext3D ensures that this resource is created with |
| 429 // the active context. | 430 // the active context. |
| 430 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); | 431 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| 431 | 432 |
| 432 cc::ContextProvider* contexts = | 433 cc::ContextProvider* contexts = |
| 433 host_impl->resourceProvider()->offscreen_context_provider(); | 434 host_impl->resource_provider()->offscreen_context_provider(); |
| 434 if (use_surface_) { | 435 if (use_surface_) { |
| 435 EXPECT_TRUE(contexts->Context3d()); | 436 EXPECT_TRUE(contexts->Context3d()); |
| 436 // TODO(danakj): Make a fake GrContext. | 437 // TODO(danakj): Make a fake GrContext. |
| 437 //EXPECT_TRUE(contexts->GrContext()); | 438 //EXPECT_TRUE(contexts->GrContext()); |
| 438 } else { | 439 } else { |
| 439 EXPECT_FALSE(contexts); | 440 EXPECT_FALSE(contexts); |
| 440 } | 441 } |
| 441 } | 442 } |
| 442 | 443 |
| 443 virtual void afterTest() OVERRIDE { | 444 virtual void afterTest() OVERRIDE { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 LayerTreeHostContextTest::setupTree(); | 513 LayerTreeHostContextTest::setupTree(); |
| 513 } | 514 } |
| 514 | 515 |
| 515 virtual void beginTest() OVERRIDE { | 516 virtual void beginTest() OVERRIDE { |
| 516 times_to_fail_create_offscreen_ = 1; | 517 times_to_fail_create_offscreen_ = 1; |
| 517 postSetNeedsCommitToMainThread(); | 518 postSetNeedsCommitToMainThread(); |
| 518 } | 519 } |
| 519 | 520 |
| 520 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 521 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 521 cc::ContextProvider* contexts = | 522 cc::ContextProvider* contexts = |
| 522 host_impl->resourceProvider()->offscreen_context_provider(); | 523 host_impl->resource_provider()->offscreen_context_provider(); |
| 523 EXPECT_FALSE(contexts); | 524 EXPECT_FALSE(contexts); |
| 524 endTest(); | 525 endTest(); |
| 525 } | 526 } |
| 526 | 527 |
| 527 virtual void afterTest() OVERRIDE {} | 528 virtual void afterTest() OVERRIDE {} |
| 528 | 529 |
| 529 protected: | 530 protected: |
| 530 FakeContentLayerClient client_; | 531 FakeContentLayerClient client_; |
| 531 scoped_refptr<Layer> root_; | 532 scoped_refptr<Layer> root_; |
| 532 scoped_refptr<ContentLayer> content_; | 533 scoped_refptr<ContentLayer> content_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 551 EXPECT_FALSE(succeeded); | 552 EXPECT_FALSE(succeeded); |
| 552 endTest(); | 553 endTest(); |
| 553 } | 554 } |
| 554 | 555 |
| 555 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 556 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 556 LayerTreeHostContextTest::commitCompleteOnThread(host_impl); | 557 LayerTreeHostContextTest::commitCompleteOnThread(host_impl); |
| 557 | 558 |
| 558 ++num_commits_; | 559 ++num_commits_; |
| 559 if (num_commits_ == 1) { | 560 if (num_commits_ == 1) { |
| 560 // When the context is ok, we should have these things. | 561 // When the context is ok, we should have these things. |
| 561 EXPECT_TRUE(host_impl->outputSurface()); | 562 EXPECT_TRUE(host_impl->output_surface()); |
| 562 EXPECT_TRUE(host_impl->renderer()); | 563 EXPECT_TRUE(host_impl->renderer()); |
| 563 EXPECT_TRUE(host_impl->resourceProvider()); | 564 EXPECT_TRUE(host_impl->resource_provider()); |
| 564 return; | 565 return; |
| 565 } | 566 } |
| 566 | 567 |
| 567 // When context recreation fails we shouldn't be left with any of them. | 568 // When context recreation fails we shouldn't be left with any of them. |
| 568 EXPECT_FALSE(host_impl->outputSurface()); | 569 EXPECT_FALSE(host_impl->output_surface()); |
| 569 EXPECT_FALSE(host_impl->renderer()); | 570 EXPECT_FALSE(host_impl->renderer()); |
| 570 EXPECT_FALSE(host_impl->resourceProvider()); | 571 EXPECT_FALSE(host_impl->resource_provider()); |
| 571 } | 572 } |
| 572 | 573 |
| 573 virtual void afterTest() OVERRIDE {} | 574 virtual void afterTest() OVERRIDE {} |
| 574 | 575 |
| 575 private: | 576 private: |
| 576 int num_commits_; | 577 int num_commits_; |
| 577 }; | 578 }; |
| 578 | 579 |
| 579 TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_SingleThrea
d) { | 580 TEST_F(LayerTreeHostContextTestLostContextFails, |
| 581 FailReinitialize100_SingleThread) { |
| 580 times_to_fail_reinitialize_ = 100; | 582 times_to_fail_reinitialize_ = 100; |
| 581 times_to_fail_recreate_ = 0; | 583 times_to_fail_recreate_ = 0; |
| 582 times_to_lose_on_recreate_ = 0; | 584 times_to_lose_on_recreate_ = 0; |
| 583 runTest(false); | 585 runTest(false); |
| 584 } | 586 } |
| 585 | 587 |
| 586 TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_MultiThread
) { | 588 TEST_F(LayerTreeHostContextTestLostContextFails, |
| 589 FailReinitialize100_MultiThread) { |
| 587 times_to_fail_reinitialize_ = 100; | 590 times_to_fail_reinitialize_ = 100; |
| 588 times_to_fail_recreate_ = 0; | 591 times_to_fail_recreate_ = 0; |
| 589 times_to_lose_on_recreate_ = 0; | 592 times_to_lose_on_recreate_ = 0; |
| 590 runTest(true); | 593 runTest(true); |
| 591 } | 594 } |
| 592 | 595 |
| 593 TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_SingleThread) { | 596 TEST_F(LayerTreeHostContextTestLostContextFails, |
| 597 FailRecreate100_SingleThread) { |
| 594 times_to_fail_reinitialize_ = 0; | 598 times_to_fail_reinitialize_ = 0; |
| 595 times_to_fail_recreate_ = 100; | 599 times_to_fail_recreate_ = 100; |
| 596 times_to_lose_on_recreate_ = 0; | 600 times_to_lose_on_recreate_ = 0; |
| 597 runTest(false); | 601 runTest(false); |
| 598 } | 602 } |
| 599 | 603 |
| 600 TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_MultiThread) { | 604 TEST_F(LayerTreeHostContextTestLostContextFails, |
| 605 FailRecreate100_MultiThread) { |
| 601 times_to_fail_reinitialize_ = 0; | 606 times_to_fail_reinitialize_ = 0; |
| 602 times_to_fail_recreate_ = 100; | 607 times_to_fail_recreate_ = 100; |
| 603 times_to_lose_on_recreate_ = 0; | 608 times_to_lose_on_recreate_ = 0; |
| 604 runTest(true); | 609 runTest(true); |
| 605 } | 610 } |
| 606 | 611 |
| 607 TEST_F(LayerTreeHostContextTestLostContextFails, LoseOnRecreate100_SingleThread)
{ | 612 TEST_F(LayerTreeHostContextTestLostContextFails, |
| 613 LoseOnRecreate100_SingleThread) { |
| 608 times_to_fail_reinitialize_ = 0; | 614 times_to_fail_reinitialize_ = 0; |
| 609 times_to_fail_recreate_ = 0; | 615 times_to_fail_recreate_ = 0; |
| 610 times_to_lose_on_recreate_ = 100; | 616 times_to_lose_on_recreate_ = 100; |
| 611 runTest(false); | 617 runTest(false); |
| 612 } | 618 } |
| 613 | 619 |
| 614 TEST_F(LayerTreeHostContextTestLostContextFails, LoseOnRecreate100_MultiThread)
{ | 620 TEST_F(LayerTreeHostContextTestLostContextFails, |
| 621 LoseOnRecreate100_MultiThread) { |
| 615 times_to_fail_reinitialize_ = 0; | 622 times_to_fail_reinitialize_ = 0; |
| 616 times_to_fail_recreate_ = 0; | 623 times_to_fail_recreate_ = 0; |
| 617 times_to_lose_on_recreate_ = 100; | 624 times_to_lose_on_recreate_ = 100; |
| 618 runTest(true); | 625 runTest(true); |
| 619 } | 626 } |
| 620 | 627 |
| 621 class LayerTreeHostContextTestFinishAllRenderingAfterLoss : | 628 class LayerTreeHostContextTestFinishAllRenderingAfterLoss : |
| 622 public LayerTreeHostContextTest { | 629 public LayerTreeHostContextTest { |
| 623 public: | 630 public: |
| 624 virtual void beginTest() OVERRIDE { | 631 virtual void beginTest() OVERRIDE { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 } | 824 } |
| 818 | 825 |
| 819 virtual void beginTest() OVERRIDE { | 826 virtual void beginTest() OVERRIDE { |
| 820 postSetNeedsCommitToMainThread(); | 827 postSetNeedsCommitToMainThread(); |
| 821 } | 828 } |
| 822 | 829 |
| 823 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 830 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 824 LayerTreeHostContextTest::commitCompleteOnThread(host_impl); | 831 LayerTreeHostContextTest::commitCompleteOnThread(host_impl); |
| 825 | 832 |
| 826 FakeContentLayerImpl* root = static_cast<FakeContentLayerImpl*>( | 833 FakeContentLayerImpl* root = static_cast<FakeContentLayerImpl*>( |
| 827 host_impl->rootLayer()); | 834 host_impl->active_tree()->root_layer()); |
| 828 FakeContentLayerImpl* child = static_cast<FakeContentLayerImpl*>( | 835 FakeContentLayerImpl* child = static_cast<FakeContentLayerImpl*>( |
| 829 root->children()[0]); | 836 root->children()[0]); |
| 830 FakeContentLayerImpl* grandchild = static_cast<FakeContentLayerImpl*>( | 837 FakeContentLayerImpl* grandchild = static_cast<FakeContentLayerImpl*>( |
| 831 child->children()[0]); | 838 child->children()[0]); |
| 832 | 839 |
| 833 ++num_commits_; | 840 ++num_commits_; |
| 834 switch (num_commits_) { | 841 switch (num_commits_) { |
| 835 case 1: | 842 case 1: |
| 836 EXPECT_EQ(0u, root->lost_output_surface_count()); | 843 EXPECT_EQ(0u, root->lost_output_surface_count()); |
| 837 EXPECT_EQ(0u, child->lost_output_surface_count()); | 844 EXPECT_EQ(0u, child->lost_output_surface_count()); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 LayerTreeHostContextTest::setupTree(); | 982 LayerTreeHostContextTest::setupTree(); |
| 976 } | 983 } |
| 977 | 984 |
| 978 virtual void beginTest() OVERRIDE { | 985 virtual void beginTest() OVERRIDE { |
| 979 postSetNeedsCommitToMainThread(); | 986 postSetNeedsCommitToMainThread(); |
| 980 } | 987 } |
| 981 | 988 |
| 982 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 989 virtual void commitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
| 983 LayerTreeHostContextTest::commitCompleteOnThread(host_impl); | 990 LayerTreeHostContextTest::commitCompleteOnThread(host_impl); |
| 984 | 991 |
| 985 ResourceProvider* resource_provider = host_impl->resourceProvider(); | 992 ResourceProvider* resource_provider = host_impl->resource_provider(); |
| 986 | 993 |
| 987 if (host_impl->activeTree()->source_frame_number() == 0) { | 994 if (host_impl->active_tree()->source_frame_number() == 0) { |
| 988 // Set up impl resources on the first commit. | 995 // Set up impl resources on the first commit. |
| 989 | 996 |
| 990 scoped_ptr<TestRenderPass> pass_for_quad = TestRenderPass::Create(); | 997 scoped_ptr<TestRenderPass> pass_for_quad = TestRenderPass::Create(); |
| 991 pass_for_quad->SetNew( | 998 pass_for_quad->SetNew( |
| 992 // AppendOneOfEveryQuadType() makes a RenderPass quad with this id. | 999 // AppendOneOfEveryQuadType() makes a RenderPass quad with this id. |
| 993 RenderPass::Id(1, 1), | 1000 RenderPass::Id(1, 1), |
| 994 gfx::Rect(0, 0, 10, 10), | 1001 gfx::Rect(0, 0, 10, 10), |
| 995 gfx::Rect(0, 0, 10, 10), | 1002 gfx::Rect(0, 0, 10, 10), |
| 996 gfx::Transform()); | 1003 gfx::Transform()); |
| 997 | 1004 |
| 998 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); | 1005 scoped_ptr<TestRenderPass> pass = TestRenderPass::Create(); |
| 999 pass->SetNew( | 1006 pass->SetNew( |
| 1000 RenderPass::Id(2, 1), | 1007 RenderPass::Id(2, 1), |
| 1001 gfx::Rect(0, 0, 10, 10), | 1008 gfx::Rect(0, 0, 10, 10), |
| 1002 gfx::Rect(0, 0, 10, 10), | 1009 gfx::Rect(0, 0, 10, 10), |
| 1003 gfx::Transform()); | 1010 gfx::Transform()); |
| 1004 pass->AppendOneOfEveryQuadType(resource_provider, RenderPass::Id(2, 1)); | 1011 pass->AppendOneOfEveryQuadType(resource_provider, RenderPass::Id(2, 1)); |
| 1005 | 1012 |
| 1006 ScopedPtrVector<RenderPass> pass_list; | 1013 ScopedPtrVector<RenderPass> pass_list; |
| 1007 pass_list.push_back(pass_for_quad.PassAs<RenderPass>()); | 1014 pass_list.push_back(pass_for_quad.PassAs<RenderPass>()); |
| 1008 pass_list.push_back(pass.PassAs<RenderPass>()); | 1015 pass_list.push_back(pass.PassAs<RenderPass>()); |
| 1009 | 1016 |
| 1010 // First child is the delegated layer. | 1017 // First child is the delegated layer. |
| 1011 FakeDelegatedRendererLayerImpl* delegated_impl = | 1018 FakeDelegatedRendererLayerImpl* delegated_impl = |
| 1012 static_cast<FakeDelegatedRendererLayerImpl*>( | 1019 static_cast<FakeDelegatedRendererLayerImpl*>( |
| 1013 host_impl->rootLayer()->children()[0]); | 1020 host_impl->active_tree()->root_layer()->children()[0]); |
| 1014 delegated_impl->SetFrameDataForRenderPasses(&pass_list); | 1021 delegated_impl->SetFrameDataForRenderPasses(&pass_list); |
| 1015 EXPECT_TRUE(pass_list.empty()); | 1022 EXPECT_TRUE(pass_list.empty()); |
| 1016 | 1023 |
| 1017 color_video_frame_ = VideoFrame::CreateColorFrame( | 1024 color_video_frame_ = VideoFrame::CreateColorFrame( |
| 1018 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); | 1025 gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); |
| 1019 hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1026 hw_video_frame_ = VideoFrame::WrapNativeTexture( |
| 1020 resource_provider->GraphicsContext3D()->createTexture(), | 1027 resource_provider->GraphicsContext3D()->createTexture(), |
| 1021 GL_TEXTURE_2D, | 1028 GL_TEXTURE_2D, |
| 1022 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), | 1029 gfx::Size(4, 4), gfx::Rect(0, 0, 4, 4), gfx::Size(4, 4), |
| 1023 base::TimeDelta(), | 1030 base::TimeDelta(), |
| 1024 VideoFrame::ReadPixelsCB(), | 1031 VideoFrame::ReadPixelsCB(), |
| 1025 base::Closure()); | 1032 base::Closure()); |
| 1026 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( | 1033 scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( |
| 1027 resource_provider->GraphicsContext3D()->createTexture(), | 1034 resource_provider->GraphicsContext3D()->createTexture(), |
| 1028 GL_TEXTURE_2D, | 1035 GL_TEXTURE_2D, |
| 1029 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), | 1036 gfx::Size(4, 4), gfx::Rect(0, 0, 3, 2), gfx::Size(4, 4), |
| 1030 base::TimeDelta(), | 1037 base::TimeDelta(), |
| 1031 VideoFrame::ReadPixelsCB(), | 1038 VideoFrame::ReadPixelsCB(), |
| 1032 base::Closure()); | 1039 base::Closure()); |
| 1033 | 1040 |
| 1034 color_frame_provider_.set_frame(color_video_frame_); | 1041 color_frame_provider_.set_frame(color_video_frame_); |
| 1035 hw_frame_provider_.set_frame(hw_video_frame_); | 1042 hw_frame_provider_.set_frame(hw_video_frame_); |
| 1036 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); | 1043 scaled_hw_frame_provider_.set_frame(scaled_hw_video_frame_); |
| 1037 return; | 1044 return; |
| 1038 } | 1045 } |
| 1039 | 1046 |
| 1040 if (host_impl->activeTree()->source_frame_number() == 3) { | 1047 if (host_impl->active_tree()->source_frame_number() == 3) { |
| 1041 // On the third commit we're recovering from context loss. Hardware | 1048 // On the third commit we're recovering from context loss. Hardware |
| 1042 // video frames should not be reused by the VideoFrameProvider, but | 1049 // video frames should not be reused by the VideoFrameProvider, but |
| 1043 // software frames can be. | 1050 // software frames can be. |
| 1044 hw_frame_provider_.set_frame(NULL); | 1051 hw_frame_provider_.set_frame(NULL); |
| 1045 scaled_hw_frame_provider_.set_frame(NULL); | 1052 scaled_hw_frame_provider_.set_frame(NULL); |
| 1046 } | 1053 } |
| 1047 } | 1054 } |
| 1048 | 1055 |
| 1049 virtual bool prepareToDrawOnThread( | 1056 virtual bool prepareToDrawOnThread( |
| 1050 LayerTreeHostImpl* host_impl, | 1057 LayerTreeHostImpl* host_impl, |
| 1051 LayerTreeHostImpl::FrameData& frame, | 1058 LayerTreeHostImpl::FrameData* frame, |
| 1052 bool result) OVERRIDE { | 1059 bool result) OVERRIDE { |
| 1053 if (host_impl->activeTree()->source_frame_number() == 2) { | 1060 if (host_impl->active_tree()->source_frame_number() == 2) { |
| 1054 // Lose the context during draw on the second commit. This will cause | 1061 // Lose the context during draw on the second commit. This will cause |
| 1055 // a third commit to recover. | 1062 // a third commit to recover. |
| 1056 if (context3d_) | 1063 if (context3d_) |
| 1057 context3d_->set_times_bind_texture_succeeds(4); | 1064 context3d_->set_times_bind_texture_succeeds(4); |
| 1058 } | 1065 } |
| 1059 return true; | 1066 return true; |
| 1060 } | 1067 } |
| 1061 | 1068 |
| 1062 virtual void didCommitAndDrawFrame() OVERRIDE { | 1069 virtual void didCommitAndDrawFrame() OVERRIDE { |
| 1063 ASSERT_TRUE(m_layerTreeHost->hud_layer()); | 1070 ASSERT_TRUE(m_layerTreeHost->hud_layer()); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 | 1226 |
| 1220 private: | 1227 private: |
| 1221 int commits_; | 1228 int commits_; |
| 1222 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; | 1229 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; |
| 1223 }; | 1230 }; |
| 1224 | 1231 |
| 1225 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext) | 1232 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext) |
| 1226 | 1233 |
| 1227 } // namespace | 1234 } // namespace |
| 1228 } // namespace cc | 1235 } // namespace cc |
| OLD | NEW |