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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 void PassThroughImageTransportSurface::SetLatencyInfo( | 219 void PassThroughImageTransportSurface::SetLatencyInfo( |
220 const std::vector<ui::LatencyInfo>& latency_info) { | 220 const std::vector<ui::LatencyInfo>& latency_info) { |
221 for (size_t i = 0; i < latency_info.size(); i++) | 221 for (size_t i = 0; i < latency_info.size(); i++) |
222 latency_info_.push_back(latency_info[i]); | 222 latency_info_.push_back(latency_info[i]); |
223 } | 223 } |
224 | 224 |
225 bool PassThroughImageTransportSurface::SwapBuffers() { | 225 bool PassThroughImageTransportSurface::SwapBuffers() { |
226 // GetVsyncValues before SwapBuffers to work around Mali driver bug: | 226 // GetVsyncValues before SwapBuffers to work around Mali driver bug: |
227 // crbug.com/223558. | 227 // crbug.com/223558. |
228 SendVSyncUpdateIfAvailable(); | 228 SendVSyncUpdateIfAvailable(); |
| 229 for (size_t i = 0; i < latency_info_.size(); ++i) { |
| 230 latency_info_[i].AddLatencyNumber( |
| 231 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0); |
| 232 } |
229 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); | 233 bool result = gfx::GLSurfaceAdapter::SwapBuffers(); |
230 for (size_t i = 0; i < latency_info_.size(); i++) { | 234 for (size_t i = 0; i < latency_info_.size(); i++) { |
231 latency_info_[i].AddLatencyNumber( | 235 latency_info_[i].AddLatencyNumber( |
232 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); | 236 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); |
233 } | 237 } |
234 | 238 |
235 helper_->SendLatencyInfo(latency_info_); | 239 helper_->SendLatencyInfo(latency_info_); |
236 latency_info_.clear(); | 240 latency_info_.clear(); |
237 return result; | 241 return result; |
238 } | 242 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { | 286 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { |
283 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); | 287 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); |
284 if (vsync_provider) { | 288 if (vsync_provider) { |
285 vsync_provider->GetVSyncParameters( | 289 vsync_provider->GetVSyncParameters( |
286 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, | 290 base::Bind(&ImageTransportHelper::SendUpdateVSyncParameters, |
287 helper_->AsWeakPtr())); | 291 helper_->AsWeakPtr())); |
288 } | 292 } |
289 } | 293 } |
290 | 294 |
291 } // namespace content | 295 } // namespace content |
OLD | NEW |