Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1295)

Side by Side Diff: cc/surfaces/surface.cc

Issue 2695243006: Don't delete CopyOutputRequests when queueing a new Surface frame. (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/surfaces/surface_unittest.cc » ('j') | cc/surfaces/surface_unittest.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DCHECK(pending_frame_); 157 DCHECK(pending_frame_);
158 ActivateFrame(std::move(pending_frame_.value())); 158 ActivateFrame(std::move(pending_frame_.value()));
159 pending_frame_.reset(); 159 pending_frame_.reset();
160 } 160 }
161 161
162 // A frame is activated if all its Surface ID dependences are active or a 162 // A frame is activated if all its Surface ID dependences are active or a
163 // deadline has hit and the frame was forcibly activated by the display 163 // deadline has hit and the frame was forcibly activated by the display
164 // compositor. 164 // compositor.
165 void Surface::ActivateFrame(CompositorFrame frame) { 165 void Surface::ActivateFrame(CompositorFrame frame) {
166 DCHECK(factory_); 166 DCHECK(factory_);
167
168 // Save root pass copy requests.
169 std::vector<std::unique_ptr<CopyOutputRequest>> old_copy_requests;
170 if (active_frame_ && !active_frame_->render_pass_list.empty()) {
171 std::swap(old_copy_requests,
172 active_frame_->render_pass_list.back()->copy_requests);
173 }
174
167 ClearCopyRequests(); 175 ClearCopyRequests();
168 176
169 TakeLatencyInfo(&frame.metadata.latency_info); 177 TakeLatencyInfo(&frame.metadata.latency_info);
170 178
171 base::Optional<CompositorFrame> previous_frame = std::move(active_frame_); 179 base::Optional<CompositorFrame> previous_frame = std::move(active_frame_);
172 active_frame_ = std::move(frame); 180 active_frame_ = std::move(frame);
173 181
182 for (auto& copy_request : old_copy_requests)
183 RequestCopyOfOutput(std::move(copy_request));
184
174 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't 185 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't
175 // increment frame index for them. 186 // increment frame index for them.
176 if (!active_frame_->render_pass_list.empty()) 187 if (!active_frame_->render_pass_list.empty())
177 ++frame_index_; 188 ++frame_index_;
178 189
179 previous_frame_surface_id_ = surface_id(); 190 previous_frame_surface_id_ = surface_id();
180 191
181 if (previous_frame) 192 if (previous_frame)
182 UnrefFrameResources(*previous_frame); 193 UnrefFrameResources(*previous_frame);
183 194
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 void Surface::ClearCopyRequests() { 325 void Surface::ClearCopyRequests() {
315 if (active_frame_) { 326 if (active_frame_) {
316 for (const auto& render_pass : active_frame_->render_pass_list) { 327 for (const auto& render_pass : active_frame_->render_pass_list) {
317 for (const auto& copy_request : render_pass->copy_requests) 328 for (const auto& copy_request : render_pass->copy_requests)
318 copy_request->SendEmptyResult(); 329 copy_request->SendEmptyResult();
319 } 330 }
320 } 331 }
321 } 332 }
322 333
323 } // namespace cc 334 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/surface_unittest.cc » ('j') | cc/surfaces/surface_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698