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

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

Issue 2652343003: Replace source pointer in cc::CopyOutputRequest with a base::UnguessableToken (Closed)
Patch Set: c Created 3 years, 10 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 QueueFrame(CompositorFrame(), DrawCallback()); 79 QueueFrame(CompositorFrame(), DrawCallback());
80 current_frame_.reset(); 80 current_frame_.reset();
81 } 81 }
82 82
83 void Surface::RequestCopyOfOutput( 83 void Surface::RequestCopyOfOutput(
84 std::unique_ptr<CopyOutputRequest> copy_request) { 84 std::unique_ptr<CopyOutputRequest> copy_request) {
85 if (current_frame_ && !current_frame_->render_pass_list.empty()) { 85 if (current_frame_ && !current_frame_->render_pass_list.empty()) {
86 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests = 86 std::vector<std::unique_ptr<CopyOutputRequest>>& copy_requests =
87 current_frame_->render_pass_list.back()->copy_requests; 87 current_frame_->render_pass_list.back()->copy_requests;
88 88
89 if (void* source = copy_request->source()) { 89 if (copy_request->has_source()) {
90 const base::UnguessableToken& source = copy_request->source();
90 // Remove existing CopyOutputRequests made on the Surface by the same 91 // Remove existing CopyOutputRequests made on the Surface by the same
91 // source. 92 // source.
92 auto to_remove = 93 auto to_remove =
93 std::remove_if(copy_requests.begin(), copy_requests.end(), 94 std::remove_if(copy_requests.begin(), copy_requests.end(),
94 [source](const std::unique_ptr<CopyOutputRequest>& x) { 95 [source](const std::unique_ptr<CopyOutputRequest>& x) {
vmpstr 2017/01/27 19:41:25 nit: capture by reference
Saman Sami 2017/01/27 20:03:20 Done.
95 return x->source() == source; 96 return x->has_source() && x->source() == source;
96 }); 97 });
97 copy_requests.erase(to_remove, copy_requests.end()); 98 copy_requests.erase(to_remove, copy_requests.end());
98 } 99 }
99 copy_requests.push_back(std::move(copy_request)); 100 copy_requests.push_back(std::move(copy_request));
100 } else { 101 } else {
101 copy_request->SendEmptyResult(); 102 copy_request->SendEmptyResult();
102 } 103 }
103 } 104 }
104 105
105 void Surface::TakeCopyOutputRequests( 106 void Surface::TakeCopyOutputRequests(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void Surface::ClearCopyRequests() { 172 void Surface::ClearCopyRequests() {
172 if (current_frame_) { 173 if (current_frame_) {
173 for (const auto& render_pass : current_frame_->render_pass_list) { 174 for (const auto& render_pass : current_frame_->render_pass_list) {
174 for (const auto& copy_request : render_pass->copy_requests) 175 for (const auto& copy_request : render_pass->copy_requests)
175 copy_request->SendEmptyResult(); 176 copy_request->SendEmptyResult();
176 } 177 }
177 } 178 }
178 } 179 }
179 180
180 } // namespace cc 181 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698