| 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/base/filter_operations.h" | 9 #include "cc/base/filter_operations.h" |
| 10 #include "cc/layers/heads_up_display_layer.h" | 10 #include "cc/layers/heads_up_display_layer.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 base::AutoLock lock(context3d_lock_); | 71 base::AutoLock lock(context3d_lock_); |
| 72 // For sanity-checking tests, they should only call this when the | 72 // For sanity-checking tests, they should only call this when the |
| 73 // context is not lost. | 73 // context is not lost. |
| 74 CHECK(context3d_); | 74 CHECK(context3d_); |
| 75 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 75 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 76 GL_INNOCENT_CONTEXT_RESET_ARB); | 76 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 77 context3d_ = nullptr; | 77 context3d_ = nullptr; |
| 78 } | 78 } |
| 79 | 79 |
| 80 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( | 80 std::unique_ptr<TestCompositorFrameSink> CreateCompositorFrameSink( |
| 81 const RendererSettings& renderer_settings, |
| 81 scoped_refptr<ContextProvider> compositor_context_provider, | 82 scoped_refptr<ContextProvider> compositor_context_provider, |
| 82 scoped_refptr<ContextProvider> worker_context_provider) override { | 83 scoped_refptr<ContextProvider> worker_context_provider) override { |
| 83 base::AutoLock lock(context3d_lock_); | 84 base::AutoLock lock(context3d_lock_); |
| 84 | 85 |
| 85 std::unique_ptr<TestWebGraphicsContext3D> compositor_context3d = | 86 std::unique_ptr<TestWebGraphicsContext3D> compositor_context3d = |
| 86 TestWebGraphicsContext3D::Create(); | 87 TestWebGraphicsContext3D::Create(); |
| 87 if (context_should_support_io_surface_) { | 88 if (context_should_support_io_surface_) { |
| 88 compositor_context3d->set_have_extension_io_surface(true); | 89 compositor_context3d->set_have_extension_io_surface(true); |
| 89 compositor_context3d->set_have_extension_egl_image(true); | 90 compositor_context3d->set_have_extension_egl_image(true); |
| 90 } | 91 } |
| 91 context3d_ = compositor_context3d.get(); | 92 context3d_ = compositor_context3d.get(); |
| 92 | 93 |
| 93 if (times_to_fail_create_) { | 94 if (times_to_fail_create_) { |
| 94 --times_to_fail_create_; | 95 --times_to_fail_create_; |
| 95 ExpectCreateToFail(); | 96 ExpectCreateToFail(); |
| 96 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 97 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 97 GL_INNOCENT_CONTEXT_RESET_ARB); | 98 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 98 } | 99 } |
| 99 | 100 |
| 100 return LayerTreeTest::CreateCompositorFrameSink( | 101 return LayerTreeTest::CreateCompositorFrameSink( |
| 102 renderer_settings, |
| 101 TestContextProvider::Create(std::move(compositor_context3d)), | 103 TestContextProvider::Create(std::move(compositor_context3d)), |
| 102 std::move(worker_context_provider)); | 104 std::move(worker_context_provider)); |
| 103 } | 105 } |
| 104 | 106 |
| 105 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 107 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 106 LayerTreeHostImpl::FrameData* frame, | 108 LayerTreeHostImpl::FrameData* frame, |
| 107 DrawResult draw_result) override { | 109 DrawResult draw_result) override { |
| 108 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { | 110 if (draw_result == DRAW_ABORTED_MISSING_HIGH_RES_CONTENT) { |
| 109 // Only valid for single-threaded compositing, which activates | 111 // Only valid for single-threaded compositing, which activates |
| 110 // immediately and will try to draw again when content has finished. | 112 // immediately and will try to draw again when content has finished. |
| (...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 | 1640 |
| 1639 FakeContentLayerClient client_; | 1641 FakeContentLayerClient client_; |
| 1640 int num_draws_ = 0; | 1642 int num_draws_ = 0; |
| 1641 }; | 1643 }; |
| 1642 | 1644 |
| 1643 MULTI_THREAD_TEST_F( | 1645 MULTI_THREAD_TEST_F( |
| 1644 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles); | 1646 LayerTreeHostContextTestLoseWorkerContextDuringPrepareTiles); |
| 1645 | 1647 |
| 1646 } // namespace | 1648 } // namespace |
| 1647 } // namespace cc | 1649 } // namespace cc |
| OLD | NEW |