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 | |
83 void Surface::RequestCopyOfOutput( | 78 void Surface::RequestCopyOfOutput( |
84 std::unique_ptr<CopyOutputRequest> copy_request) { | 79 std::unique_ptr<CopyOutputRequest> copy_request) { |
85 if (current_frame_ && !current_frame_->render_pass_list.empty()) { | 80 if (current_frame_ && !current_frame_->render_pass_list.empty()) { |
86 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests = | 81 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests = |
87 current_frame_->render_pass_list.back()->copy_requests; | 82 current_frame_->render_pass_list.back()->copy_requests; |
88 | 83 |
89 if (void* source = copy_request->source()) { | 84 if (void* source = copy_request->source()) { |
90 // Remove existing CopyOutputRequests made on the Surface by the same | 85 // Remove existing CopyOutputRequests made on the Surface by the same |
91 // source. | 86 // source. |
92 auto to_remove = | 87 auto to_remove = |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void Surface::ClearCopyRequests() { | 166 void Surface::ClearCopyRequests() { |
172 if (current_frame_) { | 167 if (current_frame_) { |
173 for (const auto& render_pass : current_frame_->render_pass_list) { | 168 for (const auto& render_pass : current_frame_->render_pass_list) { |
174 for (const auto& copy_request : render_pass->copy_requests) | 169 for (const auto& copy_request : render_pass->copy_requests) |
175 copy_request->SendEmptyResult(); | 170 copy_request->SendEmptyResult(); |
176 } | 171 } |
177 } | 172 } |
178 } | 173 } |
179 | 174 |
180 } // namespace cc | 175 } // namespace cc |
OLD | NEW |