| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "gpu/ipc/service/pass_through_image_transport_surface.h" | 5 #include "gpu/ipc/service/pass_through_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 "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "ui/gfx/vsync_provider.h" | 11 #include "ui/gfx/vsync_provider.h" |
| 12 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
| 13 #include "ui/gl/gl_switches.h" | 13 #include "ui/gl/gl_switches.h" |
| 14 | 14 |
| 15 namespace gpu { | 15 namespace gpu { |
| 16 | 16 |
| 17 PassThroughImageTransportSurface::PassThroughImageTransportSurface( | 17 PassThroughImageTransportSurface::PassThroughImageTransportSurface( |
| 18 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, | 18 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, |
| 19 gl::GLSurface* surface) | 19 gl::GLSurface* surface) |
| 20 : GLSurfaceAdapter(surface), | 20 : GLSurfaceAdapter(surface), |
| 21 delegate_(delegate), | 21 delegate_(delegate), |
| 22 did_set_swap_interval_(false), | 22 did_set_swap_interval_(false), |
| 23 weak_ptr_factory_(this) {} | 23 weak_ptr_factory_(this) {} |
| 24 | 24 |
| 25 bool PassThroughImageTransportSurface::Initialize( | 25 bool PassThroughImageTransportSurface::Initialize( |
| 26 gl::GLSurface::Format format) { | 26 gl::GLSurfaceFormat format) { |
| 27 // The surface is assumed to have already been initialized. | 27 // The surface is assumed to have already been initialized. |
| 28 delegate_->SetLatencyInfoCallback( | 28 delegate_->SetLatencyInfoCallback( |
| 29 base::Bind(&PassThroughImageTransportSurface::SetLatencyInfo, | 29 base::Bind(&PassThroughImageTransportSurface::SetLatencyInfo, |
| 30 base::Unretained(this))); | 30 base::Unretained(this))); |
| 31 return true; | 31 return true; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void PassThroughImageTransportSurface::Destroy() { | 34 void PassThroughImageTransportSurface::Destroy() { |
| 35 GLSurfaceAdapter::Destroy(); | 35 GLSurfaceAdapter::Destroy(); |
| 36 } | 36 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( | 187 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( |
| 188 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, | 188 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, |
| 189 GLSurface::SwapCompletionCallback callback, | 189 GLSurface::SwapCompletionCallback callback, |
| 190 gfx::SwapResult result) { | 190 gfx::SwapResult result) { |
| 191 FinishSwapBuffers(std::move(latency_info), result); | 191 FinishSwapBuffers(std::move(latency_info), result); |
| 192 callback.Run(result); | 192 callback.Run(result); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace gpu | 195 } // namespace gpu |
| OLD | NEW |