| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface.h" | 5 #include "cc/surfaces/surface.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 | 11 |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "cc/output/compositor_frame.h" | |
| 14 #include "cc/output/copy_output_request.h" | 13 #include "cc/output/copy_output_request.h" |
| 15 #include "cc/surfaces/compositor_frame_sink_support.h" | 14 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 16 #include "cc/surfaces/local_surface_id_allocator.h" | 15 #include "cc/surfaces/local_surface_id_allocator.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 16 #include "cc/surfaces/surface_manager.h" |
| 18 #include "cc/surfaces/surface_resource_holder_client.h" | 17 #include "cc/surfaces/surface_resource_holder_client.h" |
| 19 | 18 |
| 20 namespace cc { | 19 namespace cc { |
| 21 | 20 |
| 22 // The frame index starts at 2 so that empty frames will be treated as | 21 // The frame index starts at 2 so that empty frames will be treated as |
| 23 // completely damaged the first time they're drawn from. | 22 // completely damaged the first time they're drawn from. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 surface_manager_->RequestSurfaceResolution(this); | 108 surface_manager_->RequestSurfaceResolution(this); |
| 110 } else { | 109 } else { |
| 111 // If there are no blockers, then immediately activate the frame. | 110 // If there are no blockers, then immediately activate the frame. |
| 112 ActivateFrame(FrameData(std::move(frame), callback, will_draw_callback)); | 111 ActivateFrame(FrameData(std::move(frame), callback, will_draw_callback)); |
| 113 } | 112 } |
| 114 | 113 |
| 115 // Returns resources for the previous pending frame. | 114 // Returns resources for the previous pending frame. |
| 116 UnrefFrameResourcesAndRunDrawCallback(std::move(previous_pending_frame_data)); | 115 UnrefFrameResourcesAndRunDrawCallback(std::move(previous_pending_frame_data)); |
| 117 } | 116 } |
| 118 | 117 |
| 118 void Surface::SetProducerState(ProducerState state) { |
| 119 producer_state_ = state; |
| 120 surface_manager_->SurfaceProducerStateChanged(this, state); |
| 121 } |
| 122 |
| 119 void Surface::RequestCopyOfOutput( | 123 void Surface::RequestCopyOfOutput( |
| 120 std::unique_ptr<CopyOutputRequest> copy_request) { | 124 std::unique_ptr<CopyOutputRequest> copy_request) { |
| 121 if (!active_frame_data_) { | 125 if (!active_frame_data_) { |
| 122 copy_request->SendEmptyResult(); | 126 copy_request->SendEmptyResult(); |
| 123 return; | 127 return; |
| 124 } | 128 } |
| 125 | 129 |
| 126 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests = | 130 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests = |
| 127 active_frame_data_->frame.render_pass_list.back()->copy_requests; | 131 active_frame_data_->frame.render_pass_list.back()->copy_requests; |
| 128 | 132 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 frame->metadata.latency_info.swap(*latency_info); | 370 frame->metadata.latency_info.swap(*latency_info); |
| 367 return; | 371 return; |
| 368 } | 372 } |
| 369 std::copy(frame->metadata.latency_info.begin(), | 373 std::copy(frame->metadata.latency_info.begin(), |
| 370 frame->metadata.latency_info.end(), | 374 frame->metadata.latency_info.end(), |
| 371 std::back_inserter(*latency_info)); | 375 std::back_inserter(*latency_info)); |
| 372 frame->metadata.latency_info.clear(); | 376 frame->metadata.latency_info.clear(); |
| 373 } | 377 } |
| 374 | 378 |
| 375 } // namespace cc | 379 } // namespace cc |
| OLD | NEW |