| 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" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 void PassThroughImageTransportSurface::SetLatencyInfo( | 136 void PassThroughImageTransportSurface::SetLatencyInfo( |
| 137 const std::vector<ui::LatencyInfo>& latency_info) { | 137 const std::vector<ui::LatencyInfo>& latency_info) { |
| 138 latency_info_.insert(latency_info_.end(), latency_info.begin(), | 138 latency_info_.insert(latency_info_.end(), latency_info.begin(), |
| 139 latency_info.end()); | 139 latency_info.end()); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { | 142 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
| 143 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); | 143 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); |
| 144 if (vsync_provider) { | 144 if (vsync_provider) { |
| 145 // PassThroughImageTransportSurface owns the VSyncProvider and will | |
| 146 // outlive it. Thus, base::Unretained is safe here. | |
| 147 vsync_provider->GetVSyncParameters(base::Bind( | 145 vsync_provider->GetVSyncParameters(base::Bind( |
| 148 &ImageTransportSurfaceDelegate::UpdateVSyncParameters, delegate_)); | 146 &ImageTransportSurfaceDelegate::UpdateVSyncParameters, delegate_)); |
| 149 } | 147 } |
| 150 } | 148 } |
| 151 | 149 |
| 152 std::unique_ptr<std::vector<ui::LatencyInfo>> | 150 std::unique_ptr<std::vector<ui::LatencyInfo>> |
| 153 PassThroughImageTransportSurface::StartSwapBuffers() { | 151 PassThroughImageTransportSurface::StartSwapBuffers() { |
| 154 // GetVsyncValues before SwapBuffers to work around Mali driver bug: | 152 // GetVsyncValues before SwapBuffers to work around Mali driver bug: |
| 155 // crbug.com/223558. | 153 // crbug.com/223558. |
| 156 SendVSyncUpdateIfAvailable(); | 154 SendVSyncUpdateIfAvailable(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 186 |
| 189 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( | 187 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( |
| 190 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, | 188 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, |
| 191 GLSurface::SwapCompletionCallback callback, | 189 GLSurface::SwapCompletionCallback callback, |
| 192 gfx::SwapResult result) { | 190 gfx::SwapResult result) { |
| 193 FinishSwapBuffers(std::move(latency_info), result); | 191 FinishSwapBuffers(std::move(latency_info), result); |
| 194 callback.Run(result); | 192 callback.Run(result); |
| 195 } | 193 } |
| 196 | 194 |
| 197 } // namespace gpu | 195 } // namespace gpu |
| OLD | NEW |