| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 surface_id_allocator_->id_namespace()); | 113 surface_id_allocator_->id_namespace()); |
| 114 | 114 |
| 115 display_ = nullptr; | 115 display_ = nullptr; |
| 116 surface_factory_ = nullptr; | 116 surface_factory_ = nullptr; |
| 117 surface_id_allocator_ = nullptr; | 117 surface_id_allocator_ = nullptr; |
| 118 surface_manager_ = nullptr; | 118 surface_manager_ = nullptr; |
| 119 weak_ptrs_.InvalidateWeakPtrs(); | 119 weak_ptrs_.InvalidateWeakPtrs(); |
| 120 OutputSurface::DetachFromClient(); | 120 OutputSurface::DetachFromClient(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void PixelTestDelegatingOutputSurface::SwapBuffers(CompositorFrame* frame) { | 123 void PixelTestDelegatingOutputSurface::SwapBuffers(CompositorFrame frame) { |
| 124 client_->DidSwapBuffers(); | 124 client_->DidSwapBuffers(); |
| 125 | 125 |
| 126 if (delegated_surface_id_.is_null()) { | 126 if (delegated_surface_id_.is_null()) { |
| 127 delegated_surface_id_ = surface_id_allocator_->GenerateId(); | 127 delegated_surface_id_ = surface_id_allocator_->GenerateId(); |
| 128 surface_factory_->Create(delegated_surface_id_); | 128 surface_factory_->Create(delegated_surface_id_); |
| 129 } | 129 } |
| 130 display_->SetSurfaceId(delegated_surface_id_, | 130 display_->SetSurfaceId(delegated_surface_id_, |
| 131 frame->metadata.device_scale_factor); | 131 frame.metadata.device_scale_factor); |
| 132 | 132 |
| 133 gfx::Size frame_size = | 133 gfx::Size frame_size = |
| 134 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); | 134 frame.delegated_frame_data->render_pass_list.back()->output_rect.size(); |
| 135 display_->Resize(frame_size); | 135 display_->Resize(frame_size); |
| 136 | 136 |
| 137 std::unique_ptr<CompositorFrame> my_frame(new CompositorFrame); | 137 std::unique_ptr<CompositorFrame> frame_copy(new CompositorFrame); |
| 138 frame->AssignTo(my_frame.get()); | 138 *frame_copy = std::move(frame); |
| 139 surface_factory_->SubmitCompositorFrame( | 139 surface_factory_->SubmitCompositorFrame( |
| 140 delegated_surface_id_, std::move(my_frame), | 140 delegated_surface_id_, std::move(frame_copy), |
| 141 base::Bind(&PixelTestDelegatingOutputSurface::DrawCallback, | 141 base::Bind(&PixelTestDelegatingOutputSurface::DrawCallback, |
| 142 weak_ptrs_.GetWeakPtr())); | 142 weak_ptrs_.GetWeakPtr())); |
| 143 | 143 |
| 144 if (synchronous_composite_) | 144 if (synchronous_composite_) |
| 145 display_->DrawAndSwap(); | 145 display_->DrawAndSwap(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void PixelTestDelegatingOutputSurface::SetEnlargePassTextureAmount( | 148 void PixelTestDelegatingOutputSurface::SetEnlargePassTextureAmount( |
| 149 const gfx::Size& amount) { | 149 const gfx::Size& amount) { |
| 150 DCHECK(!HasClient()); | 150 DCHECK(!HasClient()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 179 ack.resources = resources; | 179 ack.resources = resources; |
| 180 client_->ReclaimResources(&ack); | 180 client_->ReclaimResources(&ack); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( | 183 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( |
| 184 BeginFrameSource* begin_frame_source) { | 184 BeginFrameSource* begin_frame_source) { |
| 185 client_->SetBeginFrameSource(begin_frame_source); | 185 client_->SetBeginFrameSource(begin_frame_source); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace cc | 188 } // namespace cc |
| OLD | NEW |