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> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (previous_frame) | 68 if (previous_frame) |
69 UnrefFrameResources(*previous_frame); | 69 UnrefFrameResources(*previous_frame); |
70 | 70 |
71 if (!draw_callback_.is_null()) | 71 if (!draw_callback_.is_null()) |
72 draw_callback_.Run(); | 72 draw_callback_.Run(); |
73 draw_callback_ = callback; | 73 draw_callback_ = callback; |
74 | 74 |
75 referenced_surfaces_ = current_frame_->metadata.referenced_surfaces; | 75 referenced_surfaces_ = current_frame_->metadata.referenced_surfaces; |
76 } | 76 } |
77 | 77 |
| 78 void Surface::EvictFrame() { |
| 79 QueueFrame(CompositorFrame(), DrawCallback()); |
| 80 current_frame_.reset(); |
| 81 } |
| 82 |
78 void Surface::RequestCopyOfOutput( | 83 void Surface::RequestCopyOfOutput( |
79 std::unique_ptr<CopyOutputRequest> copy_request) { | 84 std::unique_ptr<CopyOutputRequest> copy_request) { |
80 if (current_frame_ && !current_frame_->render_pass_list.empty()) { | 85 if (current_frame_ && !current_frame_->render_pass_list.empty()) { |
81 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests = | 86 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests = |
82 current_frame_->render_pass_list.back()->copy_requests; | 87 current_frame_->render_pass_list.back()->copy_requests; |
83 | 88 |
84 if (void* source = copy_request->source()) { | 89 if (void* source = copy_request->source()) { |
85 // Remove existing CopyOutputRequests made on the Surface by the same | 90 // Remove existing CopyOutputRequests made on the Surface by the same |
86 // source. | 91 // source. |
87 auto to_remove = | 92 auto to_remove = |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void Surface::ClearCopyRequests() { | 171 void Surface::ClearCopyRequests() { |
167 if (current_frame_) { | 172 if (current_frame_) { |
168 for (const auto& render_pass : current_frame_->render_pass_list) { | 173 for (const auto& render_pass : current_frame_->render_pass_list) { |
169 for (const auto& copy_request : render_pass->copy_requests) | 174 for (const auto& copy_request : render_pass->copy_requests) |
170 copy_request->SendEmptyResult(); | 175 copy_request->SendEmptyResult(); |
171 } | 176 } |
172 } | 177 } |
173 } | 178 } |
174 | 179 |
175 } // namespace cc | 180 } // namespace cc |
OLD | NEW |