| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 int height, | 203 int height, |
| 204 const GLSurface::SwapCompletionCallback& callback) { | 204 const GLSurface::SwapCompletionCallback& callback) { |
| 205 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); | 205 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); |
| 206 gfx::GLSurfaceAdapter::PostSubBufferAsync( | 206 gfx::GLSurfaceAdapter::PostSubBufferAsync( |
| 207 x, y, width, height, | 207 x, y, width, height, |
| 208 base::Bind(&PassThroughImageTransportSurface::FinishSwapBuffersAsync, | 208 base::Bind(&PassThroughImageTransportSurface::FinishSwapBuffersAsync, |
| 209 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), | 209 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), |
| 210 callback)); | 210 callback)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 gfx::SwapResult PassThroughImageTransportSurface::CommitOverlayPlanes() { |
| 214 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); |
| 215 gfx::SwapResult result = gfx::GLSurfaceAdapter::CommitOverlayPlanes(); |
| 216 FinishSwapBuffers(latency_info.Pass(), result); |
| 217 return result; |
| 218 } |
| 219 |
| 220 void PassThroughImageTransportSurface::CommitOverlayPlanesAsync( |
| 221 const GLSurface::SwapCompletionCallback& callback) { |
| 222 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); |
| 223 gfx::GLSurfaceAdapter::CommitOverlayPlanesAsync(base::Bind( |
| 224 &PassThroughImageTransportSurface::FinishSwapBuffersAsync, |
| 225 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), callback)); |
| 226 } |
| 227 |
| 213 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { | 228 bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |
| 214 if (!did_set_swap_interval_) { | 229 if (!did_set_swap_interval_) { |
| 215 ImageTransportHelper::SetSwapInterval(context); | 230 ImageTransportHelper::SetSwapInterval(context); |
| 216 did_set_swap_interval_ = true; | 231 did_set_swap_interval_ = true; |
| 217 } | 232 } |
| 218 return true; | 233 return true; |
| 219 } | 234 } |
| 220 | 235 |
| 221 #if defined(OS_MACOSX) | 236 #if defined(OS_MACOSX) |
| 222 void PassThroughImageTransportSurface::OnBufferPresented( | 237 void PassThroughImageTransportSurface::OnBufferPresented( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 289 |
| 275 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( | 290 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( |
| 276 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info, | 291 scoped_ptr<std::vector<ui::LatencyInfo>> latency_info, |
| 277 GLSurface::SwapCompletionCallback callback, | 292 GLSurface::SwapCompletionCallback callback, |
| 278 gfx::SwapResult result) { | 293 gfx::SwapResult result) { |
| 279 FinishSwapBuffers(latency_info.Pass(), result); | 294 FinishSwapBuffers(latency_info.Pass(), result); |
| 280 callback.Run(result); | 295 callback.Run(result); |
| 281 } | 296 } |
| 282 | 297 |
| 283 } // namespace content | 298 } // namespace content |
| OLD | NEW |