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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void PassThroughImageTransportSurface::SetLatencyInfo( | 196 void PassThroughImageTransportSurface::SetLatencyInfo( |
197 const std::vector<ui::LatencyInfo>& latency_info) { | 197 const std::vector<ui::LatencyInfo>& latency_info) { |
198 for (size_t i = 0; i < latency_info.size(); i++) | 198 for (size_t i = 0; i < latency_info.size(); i++) |
199 latency_info_.push_back(latency_info[i]); | 199 latency_info_.push_back(latency_info[i]); |
200 } | 200 } |
201 | 201 |
202 bool PassThroughImageTransportSurface::SwapBuffers() { | 202 bool PassThroughImageTransportSurface::SwapBuffers() { |
203 // GetVsyncValues before SwapBuffers to work around Mali driver bug: | 203 // GetVsyncValues before SwapBuffers to work around Mali driver bug: |
204 // crbug.com/223558. | 204 // crbug.com/223558. |
205 SendVSyncUpdateIfAvailable(); | 205 SendVSyncUpdateIfAvailable(); |
| 206 for (auto& latency : latency_info_) |
| 207 latency.AddLatencyNumber(ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0); |
| 208 |
206 // We use WeakPtr here to avoid manual management of life time of an instance | 209 // We use WeakPtr here to avoid manual management of life time of an instance |
207 // of this class. Callback will not be called once the instance of this class | 210 // of this class. Callback will not be called once the instance of this class |
208 // is destroyed. However, this also means that the callback can be run on | 211 // is destroyed. However, this also means that the callback can be run on |
209 // the calling thread only. | 212 // the calling thread only. |
210 return gfx::GLSurfaceAdapter::SwapBuffersAsync( | 213 return gfx::GLSurfaceAdapter::SwapBuffersAsync( |
211 base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, | 214 base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, |
212 weak_ptr_factory_.GetWeakPtr())); | 215 weak_ptr_factory_.GetWeakPtr())); |
213 } | 216 } |
214 | 217 |
215 bool PassThroughImageTransportSurface::PostSubBuffer( | 218 bool PassThroughImageTransportSurface::PostSubBuffer( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { | 270 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
268 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); | 271 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); |
269 if (vsync_provider) { | 272 if (vsync_provider) { |
270 vsync_provider->GetVSyncParameters( | 273 vsync_provider->GetVSyncParameters( |
271 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, | 274 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, |
272 helper_->AsWeakPtr())); | 275 helper_->AsWeakPtr())); |
273 } | 276 } |
274 } | 277 } |
275 | 278 |
276 } // namespace content | 279 } // namespace content |
OLD | NEW |