| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/layers/delegated_frame_provider.h" | 8 #include "cc/layers/delegated_frame_provider.h" |
| 9 #include "cc/layers/delegated_frame_resource_collection.h" | 9 #include "cc/layers/delegated_frame_resource_collection.h" |
| 10 #include "cc/layers/heads_up_display_layer.h" | 10 #include "cc/layers/heads_up_display_layer.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); | 93 scoped_ptr<TestWebGraphicsContext3D> context3d = CreateContext3d(); |
| 94 base::AutoLock lock(context3d_lock_); | 94 base::AutoLock lock(context3d_lock_); |
| 95 context3d_ = context3d.get(); | 95 context3d_ = context3d.get(); |
| 96 | 96 |
| 97 if (context_should_support_io_surface_) { | 97 if (context_should_support_io_surface_) { |
| 98 context3d_->set_have_extension_io_surface(true); | 98 context3d_->set_have_extension_io_surface(true); |
| 99 context3d_->set_have_extension_egl_image(true); | 99 context3d_->set_have_extension_egl_image(true); |
| 100 } | 100 } |
| 101 | 101 |
| 102 if (delegating_renderer()) | 102 if (delegating_renderer()) |
| 103 return FakeOutputSurface::CreateDelegating3d(context3d.Pass()); | 103 return FakeOutputSurface::CreateDelegating3d(std::move(context3d)); |
| 104 else | 104 else |
| 105 return FakeOutputSurface::Create3d(context3d.Pass()); | 105 return FakeOutputSurface::Create3d(std::move(context3d)); |
| 106 } | 106 } |
| 107 | 107 |
| 108 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 108 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 109 LayerTreeHostImpl::FrameData* frame, | 109 LayerTreeHostImpl::FrameData* frame, |
| 110 DrawResult draw_result) override { | 110 DrawResult draw_result) override { |
| 111 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { | 111 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { |
| 112 // Only valid for single-threaded compositing, which activates | 112 // Only valid for single-threaded compositing, which activates |
| 113 // immediately and will try to draw again when content has finished. | 113 // immediately and will try to draw again when content has finished. |
| 114 DCHECK(!host_impl->task_runner_provider()->HasImplThread()); | 114 DCHECK(!host_impl->task_runner_provider()->HasImplThread()); |
| 115 return draw_result; | 115 return draw_result; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 base::Unretained(this))); | 187 base::Unretained(this))); |
| 188 } else { | 188 } else { |
| 189 CreateAndSetOutputSurface(); | 189 CreateAndSetOutputSurface(); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 void CreateAndSetOutputSurface() { | 193 void CreateAndSetOutputSurface() { |
| 194 scoped_ptr<OutputSurface> surface( | 194 scoped_ptr<OutputSurface> surface( |
| 195 LayerTreeHostContextTest::CreateOutputSurface()); | 195 LayerTreeHostContextTest::CreateOutputSurface()); |
| 196 CHECK(surface); | 196 CHECK(surface); |
| 197 layer_tree_host()->SetOutputSurface(surface.Pass()); | 197 layer_tree_host()->SetOutputSurface(std::move(surface)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void DidInitializeOutputSurface() override { | 200 void DidInitializeOutputSurface() override { |
| 201 if (first_initialized_) | 201 if (first_initialized_) |
| 202 ++num_losses_; | 202 ++num_losses_; |
| 203 else | 203 else |
| 204 first_initialized_ = true; | 204 first_initialized_ = true; |
| 205 | 205 |
| 206 recovered_context_ = true; | 206 recovered_context_ = true; |
| 207 } | 207 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 void RequestNewOutputSurface() override { | 401 void RequestNewOutputSurface() override { |
| 402 if (layer_tree_host()->visible()) | 402 if (layer_tree_host()->visible()) |
| 403 CreateAndSetOutputSurface(); | 403 CreateAndSetOutputSurface(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void CreateAndSetOutputSurface() { | 406 void CreateAndSetOutputSurface() { |
| 407 scoped_ptr<OutputSurface> surface = | 407 scoped_ptr<OutputSurface> surface = |
| 408 LayerTreeHostContextTest::CreateOutputSurface(); | 408 LayerTreeHostContextTest::CreateOutputSurface(); |
| 409 CHECK(surface); | 409 CHECK(surface); |
| 410 setos_counter_++; | 410 setos_counter_++; |
| 411 layer_tree_host()->SetOutputSurface(surface.Pass()); | 411 layer_tree_host()->SetOutputSurface(std::move(surface)); |
| 412 } | 412 } |
| 413 | 413 |
| 414 void HideAndReleaseOutputSurface() { | 414 void HideAndReleaseOutputSurface() { |
| 415 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); | 415 EXPECT_TRUE(layer_tree_host()->task_runner_provider()->IsMainThread()); |
| 416 layer_tree_host()->SetVisible(false); | 416 layer_tree_host()->SetVisible(false); |
| 417 scoped_ptr<OutputSurface> surface = | 417 scoped_ptr<OutputSurface> surface = |
| 418 layer_tree_host()->ReleaseOutputSurface(); | 418 layer_tree_host()->ReleaseOutputSurface(); |
| 419 CHECK(surface); | 419 CHECK(surface); |
| 420 MainThreadTaskRunner()->PostTask( | 420 MainThreadTaskRunner()->PostTask( |
| 421 FROM_HERE, | 421 FROM_HERE, |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 | 929 |
| 930 scoped_ptr<RenderPass> pass = RenderPass::Create(); | 930 scoped_ptr<RenderPass> pass = RenderPass::Create(); |
| 931 pass->SetNew(RenderPassId(1, 1), | 931 pass->SetNew(RenderPassId(1, 1), |
| 932 gfx::Rect(0, 0, 10, 10), | 932 gfx::Rect(0, 0, 10, 10), |
| 933 gfx::Rect(0, 0, 10, 10), | 933 gfx::Rect(0, 0, 10, 10), |
| 934 gfx::Transform()); | 934 gfx::Transform()); |
| 935 uint32_t mailbox_sync_point; | 935 uint32_t mailbox_sync_point; |
| 936 AddOneOfEveryQuadType(pass.get(), child_resource_provider_.get(), | 936 AddOneOfEveryQuadType(pass.get(), child_resource_provider_.get(), |
| 937 RenderPassId(2, 1), &mailbox_sync_point); | 937 RenderPassId(2, 1), &mailbox_sync_point); |
| 938 | 938 |
| 939 frame_data->render_pass_list.push_back(pass_for_quad.Pass()); | 939 frame_data->render_pass_list.push_back(std::move(pass_for_quad)); |
| 940 frame_data->render_pass_list.push_back(pass.Pass()); | 940 frame_data->render_pass_list.push_back(std::move(pass)); |
| 941 | 941 |
| 942 delegated_resource_collection_ = new DelegatedFrameResourceCollection; | 942 delegated_resource_collection_ = new DelegatedFrameResourceCollection; |
| 943 delegated_frame_provider_ = new DelegatedFrameProvider( | 943 delegated_frame_provider_ = new DelegatedFrameProvider( |
| 944 delegated_resource_collection_.get(), frame_data.Pass()); | 944 delegated_resource_collection_.get(), std::move(frame_data)); |
| 945 | 945 |
| 946 ResourceId resource = child_resource_provider_->CreateResource( | 946 ResourceId resource = child_resource_provider_->CreateResource( |
| 947 gfx::Size(4, 4), ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); | 947 gfx::Size(4, 4), ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); |
| 948 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), | 948 ResourceProvider::ScopedWriteLockGL lock(child_resource_provider_.get(), |
| 949 resource); | 949 resource); |
| 950 | 950 |
| 951 gpu::Mailbox mailbox; | 951 gpu::Mailbox mailbox; |
| 952 gl->GenMailboxCHROMIUM(mailbox.name); | 952 gl->GenMailboxCHROMIUM(mailbox.name); |
| 953 gpu::SyncToken sync_token(gl->InsertSyncPointCHROMIUM()); | 953 gpu::SyncToken sync_token(gl->InsertSyncPointCHROMIUM()); |
| 954 | 954 |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 void AfterTest() override {} | 1622 void AfterTest() override {} |
| 1623 | 1623 |
| 1624 bool deferred_; | 1624 bool deferred_; |
| 1625 }; | 1625 }; |
| 1626 | 1626 |
| 1627 SINGLE_AND_MULTI_THREAD_TEST_F( | 1627 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1628 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); | 1628 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); |
| 1629 | 1629 |
| 1630 } // namespace | 1630 } // namespace |
| 1631 } // namespace cc | 1631 } // namespace cc |
| OLD | NEW |