| 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/test/fake_output_surface.h" | 5 #include "cc/test/fake_output_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "cc/output/compositor_frame_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
| 10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 std::unique_ptr<SoftwareOutputDevice> software_device, | 37 std::unique_ptr<SoftwareOutputDevice> software_device, |
| 38 bool delegated_rendering) | 38 bool delegated_rendering) |
| 39 : OutputSurface(std::move(context_provider), | 39 : OutputSurface(std::move(context_provider), |
| 40 std::move(worker_context_provider), | 40 std::move(worker_context_provider), |
| 41 std::move(software_device)) { | 41 std::move(software_device)) { |
| 42 capabilities_.delegated_rendering = delegated_rendering; | 42 capabilities_.delegated_rendering = delegated_rendering; |
| 43 } | 43 } |
| 44 | 44 |
| 45 FakeOutputSurface::~FakeOutputSurface() {} | 45 FakeOutputSurface::~FakeOutputSurface() {} |
| 46 | 46 |
| 47 void FakeOutputSurface::SwapBuffers(CompositorFrame* frame) { | 47 void FakeOutputSurface::SwapBuffers(CompositorFrame frame) { |
| 48 if (frame->delegated_frame_data || !context_provider()) { | 48 std::unique_ptr<CompositorFrame> frame_copy(new CompositorFrame); |
| 49 frame->AssignTo(&last_sent_frame_); | 49 *frame_copy = std::move(frame); |
| 50 if (frame_copy->delegated_frame_data || !context_provider()) { |
| 51 last_sent_frame_ = std::move(frame_copy); |
| 50 | 52 |
| 51 if (last_sent_frame_.delegated_frame_data) { | 53 if (last_sent_frame_->delegated_frame_data) { |
| 52 resources_held_by_parent_.insert( | 54 resources_held_by_parent_.insert( |
| 53 resources_held_by_parent_.end(), | 55 resources_held_by_parent_.end(), |
| 54 last_sent_frame_.delegated_frame_data->resource_list.begin(), | 56 last_sent_frame_->delegated_frame_data->resource_list.begin(), |
| 55 last_sent_frame_.delegated_frame_data->resource_list.end()); | 57 last_sent_frame_->delegated_frame_data->resource_list.end()); |
| 56 } | 58 } |
| 57 | 59 |
| 58 ++num_sent_frames_; | 60 ++num_sent_frames_; |
| 59 } else { | 61 } else { |
| 60 last_swap_rect_ = frame->gl_frame_data->sub_buffer_rect; | 62 last_swap_rect_ = frame_copy->gl_frame_data->sub_buffer_rect; |
| 61 frame->AssignTo(&last_sent_frame_); | 63 last_sent_frame_ = std::move(frame_copy); |
| 62 ++num_sent_frames_; | 64 ++num_sent_frames_; |
| 63 } | 65 } |
| 64 PostSwapBuffersComplete(); | 66 PostSwapBuffersComplete(); |
| 65 client_->DidSwapBuffers(); | 67 client_->DidSwapBuffers(); |
| 66 } | 68 } |
| 67 | 69 |
| 68 void FakeOutputSurface::BindFramebuffer() { | 70 void FakeOutputSurface::BindFramebuffer() { |
| 69 if (framebuffer_) { | 71 if (framebuffer_) { |
| 70 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, | 72 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, |
| 71 framebuffer_); | 73 framebuffer_); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 const { | 127 const { |
| 126 return overlay_candidate_validator_; | 128 return overlay_candidate_validator_; |
| 127 } | 129 } |
| 128 | 130 |
| 129 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | 131 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( |
| 130 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | 132 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { |
| 131 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); | 133 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); |
| 132 } | 134 } |
| 133 | 135 |
| 134 } // namespace cc | 136 } // namespace cc |
| OLD | NEW |