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

Side by Side Diff: content/common/gpu/image_transport_surface.cc

Issue 1544293002: Convert Pass()→std::move() in //content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/gpu/image_transport_surface.h" 5 #include "content/common/gpu/image_transport_surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "content/common/gpu/gpu_channel.h" 15 #include "content/common/gpu/gpu_channel.h"
15 #include "content/common/gpu/gpu_channel_manager.h" 16 #include "content/common/gpu/gpu_channel_manager.h"
16 #include "content/common/gpu/gpu_command_buffer_stub.h" 17 #include "content/common/gpu/gpu_command_buffer_stub.h"
17 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 165
165 void PassThroughImageTransportSurface::SetLatencyInfo( 166 void PassThroughImageTransportSurface::SetLatencyInfo(
166 const std::vector<ui::LatencyInfo>& latency_info) { 167 const std::vector<ui::LatencyInfo>& latency_info) {
167 for (size_t i = 0; i < latency_info.size(); i++) 168 for (size_t i = 0; i < latency_info.size(); i++)
168 latency_info_.push_back(latency_info[i]); 169 latency_info_.push_back(latency_info[i]);
169 } 170 }
170 171
171 gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() { 172 gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() {
172 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); 173 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers();
173 gfx::SwapResult result = gfx::GLSurfaceAdapter::SwapBuffers(); 174 gfx::SwapResult result = gfx::GLSurfaceAdapter::SwapBuffers();
174 FinishSwapBuffers(latency_info.Pass(), result); 175 FinishSwapBuffers(std::move(latency_info), result);
175 return result; 176 return result;
176 } 177 }
177 178
178 void PassThroughImageTransportSurface::SwapBuffersAsync( 179 void PassThroughImageTransportSurface::SwapBuffersAsync(
179 const GLSurface::SwapCompletionCallback& callback) { 180 const GLSurface::SwapCompletionCallback& callback) {
180 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); 181 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers();
181 182
182 // We use WeakPtr here to avoid manual management of life time of an instance 183 // We use WeakPtr here to avoid manual management of life time of an instance
183 // of this class. Callback will not be called once the instance of this class 184 // of this class. Callback will not be called once the instance of this class
184 // is destroyed. However, this also means that the callback can be run on 185 // is destroyed. However, this also means that the callback can be run on
185 // the calling thread only. 186 // the calling thread only.
186 gfx::GLSurfaceAdapter::SwapBuffersAsync(base::Bind( 187 gfx::GLSurfaceAdapter::SwapBuffersAsync(base::Bind(
187 &PassThroughImageTransportSurface::FinishSwapBuffersAsync, 188 &PassThroughImageTransportSurface::FinishSwapBuffersAsync,
188 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), callback)); 189 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), callback));
189 } 190 }
190 191
191 gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x, 192 gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x,
192 int y, 193 int y,
193 int width, 194 int width,
194 int height) { 195 int height) {
195 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); 196 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers();
196 gfx::SwapResult result = 197 gfx::SwapResult result =
197 gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); 198 gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height);
198 FinishSwapBuffers(latency_info.Pass(), result); 199 FinishSwapBuffers(std::move(latency_info), result);
199 return result; 200 return result;
200 } 201 }
201 202
202 void PassThroughImageTransportSurface::PostSubBufferAsync( 203 void PassThroughImageTransportSurface::PostSubBufferAsync(
203 int x, 204 int x,
204 int y, 205 int y,
205 int width, 206 int width,
206 int height, 207 int height,
207 const GLSurface::SwapCompletionCallback& callback) { 208 const GLSurface::SwapCompletionCallback& callback) {
208 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); 209 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers();
209 gfx::GLSurfaceAdapter::PostSubBufferAsync( 210 gfx::GLSurfaceAdapter::PostSubBufferAsync(
210 x, y, width, height, 211 x, y, width, height,
211 base::Bind(&PassThroughImageTransportSurface::FinishSwapBuffersAsync, 212 base::Bind(&PassThroughImageTransportSurface::FinishSwapBuffersAsync,
212 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), 213 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info),
213 callback)); 214 callback));
214 } 215 }
215 216
216 gfx::SwapResult PassThroughImageTransportSurface::CommitOverlayPlanes() { 217 gfx::SwapResult PassThroughImageTransportSurface::CommitOverlayPlanes() {
217 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); 218 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers();
218 gfx::SwapResult result = gfx::GLSurfaceAdapter::CommitOverlayPlanes(); 219 gfx::SwapResult result = gfx::GLSurfaceAdapter::CommitOverlayPlanes();
219 FinishSwapBuffers(latency_info.Pass(), result); 220 FinishSwapBuffers(std::move(latency_info), result);
220 return result; 221 return result;
221 } 222 }
222 223
223 void PassThroughImageTransportSurface::CommitOverlayPlanesAsync( 224 void PassThroughImageTransportSurface::CommitOverlayPlanesAsync(
224 const GLSurface::SwapCompletionCallback& callback) { 225 const GLSurface::SwapCompletionCallback& callback) {
225 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); 226 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers();
226 gfx::GLSurfaceAdapter::CommitOverlayPlanesAsync(base::Bind( 227 gfx::GLSurfaceAdapter::CommitOverlayPlanesAsync(base::Bind(
227 &PassThroughImageTransportSurface::FinishSwapBuffersAsync, 228 &PassThroughImageTransportSurface::FinishSwapBuffersAsync,
228 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), callback)); 229 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), callback));
229 } 230 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 swap_ack_time, 1); 288 swap_ack_time, 1);
288 } 289 }
289 290
290 helper_->stub()->SendSwapBuffersCompleted(*latency_info, result); 291 helper_->stub()->SendSwapBuffersCompleted(*latency_info, result);
291 } 292 }
292 293
293 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( 294 void PassThroughImageTransportSurface::FinishSwapBuffersAsync(
294 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info, 295 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info,
295 GLSurface::SwapCompletionCallback callback, 296 GLSurface::SwapCompletionCallback callback,
296 gfx::SwapResult result) { 297 gfx::SwapResult result) {
297 FinishSwapBuffers(latency_info.Pass(), result); 298 FinishSwapBuffers(std::move(latency_info), result);
298 callback.Run(result); 299 callback.Run(result);
299 } 300 }
300 301
301 } // namespace content 302 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.cc ('k') | content/common/gpu/media/gpu_jpeg_decode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698