| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/pixel_test_delegating_output_surface.h" | 5 #include "cc/test/pixel_test_delegating_output_surface.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 new TestInProcessContextProvider(nullptr)); | 74 new TestInProcessContextProvider(nullptr)); |
| 75 bool flipped_output_surface = false; | 75 bool flipped_output_surface = false; |
| 76 output_surface = base::MakeUnique<PixelTestOutputSurface>( | 76 output_surface = base::MakeUnique<PixelTestOutputSurface>( |
| 77 std::move(context), nullptr, flipped_output_surface, nullptr); | 77 std::move(context), nullptr, flipped_output_surface, nullptr); |
| 78 } | 78 } |
| 79 output_surface->set_surface_expansion_size(surface_expansion_size); | 79 output_surface->set_surface_expansion_size(surface_expansion_size); |
| 80 | 80 |
| 81 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); | 81 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); |
| 82 CHECK(task_runner); | 82 CHECK(task_runner); |
| 83 | 83 |
| 84 if (!synchronous_composite_) |
| 85 begin_frame_source_.reset(new BackToBackBeginFrameSource(task_runner)); |
| 86 DCHECK_EQ(synchronous_composite_, !begin_frame_source_); |
| 87 |
| 84 display_.reset(new Display(surface_manager_.get(), shared_bitmap_manager_, | 88 display_.reset(new Display(surface_manager_.get(), shared_bitmap_manager_, |
| 85 gpu_memory_buffer_manager_, RendererSettings(), | 89 gpu_memory_buffer_manager_, RendererSettings(), |
| 86 surface_id_allocator_->id_namespace(), task_runner, | 90 surface_id_allocator_->id_namespace(), task_runner, |
| 91 begin_frame_source_.get(), |
| 87 std::move(output_surface))); | 92 std::move(output_surface))); |
| 88 display_->SetEnlargePassTextureAmountForTesting(enlarge_pass_texture_amount_); | 93 display_->SetEnlargePassTextureAmountForTesting(enlarge_pass_texture_amount_); |
| 89 | 94 |
| 90 if (synchronous_composite_) { | 95 bool init = display_->Initialize(&display_client_); |
| 91 bool init = display_->InitializeSynchronous(&display_client_); | 96 CHECK(init); |
| 92 CHECK(init); | |
| 93 } else { | |
| 94 begin_frame_source_.reset(new BackToBackBeginFrameSource(task_runner)); | |
| 95 display_->SetBeginFrameSource(begin_frame_source_.get()); | |
| 96 | |
| 97 bool init = display_->Initialize(&display_client_); | |
| 98 CHECK(init); | |
| 99 } | |
| 100 | |
| 101 return true; | 97 return true; |
| 102 } | 98 } |
| 103 | 99 |
| 104 void PixelTestDelegatingOutputSurface::DetachFromClient() { | 100 void PixelTestDelegatingOutputSurface::DetachFromClient() { |
| 105 if (!delegated_surface_id_.is_null()) | 101 if (!delegated_surface_id_.is_null()) |
| 106 surface_factory_->Destroy(delegated_surface_id_); | 102 surface_factory_->Destroy(delegated_surface_id_); |
| 107 surface_manager_->UnregisterSurfaceFactoryClient( | 103 surface_manager_->UnregisterSurfaceFactoryClient( |
| 108 surface_id_allocator_->id_namespace()); | 104 surface_id_allocator_->id_namespace()); |
| 109 | 105 |
| 110 display_ = nullptr; | 106 display_ = nullptr; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 ack.resources = resources; | 159 ack.resources = resources; |
| 164 client_->ReclaimResources(&ack); | 160 client_->ReclaimResources(&ack); |
| 165 } | 161 } |
| 166 | 162 |
| 167 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( | 163 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( |
| 168 BeginFrameSource* begin_frame_source) { | 164 BeginFrameSource* begin_frame_source) { |
| 169 client_->SetBeginFrameSource(begin_frame_source); | 165 client_->SetBeginFrameSource(begin_frame_source); |
| 170 } | 166 } |
| 171 | 167 |
| 172 } // namespace cc | 168 } // namespace cc |
| OLD | NEW |