Index: content/common/gpu/image_transport_surface.cc |
diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc |
index b6367dd4cd8b7e74f153726f5b4a3e7d4b179170..5e7c2b0be71c3e08001b2a770a89c5f31231dec8 100644 |
--- a/content/common/gpu/image_transport_surface.cc |
+++ b/content/common/gpu/image_transport_surface.cc |
@@ -202,9 +202,11 @@ bool PassThroughImageTransportSurface::SwapBuffers() { |
// of this class. Callback will not be called once the instance of this class |
// is destroyed. However, this also means that the callback can be run on |
// the calling thread only. |
+ std::vector<ui::LatencyInfo> latency_info; |
+ latency_info.swap(latency_info_); |
return gfx::GLSurfaceAdapter::SwapBuffersAsync( |
base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, |
- weak_ptr_factory_.GetWeakPtr())); |
+ weak_ptr_factory_.GetWeakPtr(), latency_info)); |
} |
bool PassThroughImageTransportSurface::PostSubBuffer( |
@@ -221,21 +223,24 @@ bool PassThroughImageTransportSurface::PostSubBuffer( |
// of this class. Callback will not be called once the instance of this class |
// is destroyed. However, this also means that the callback can be run on |
// the calling thread only. |
- return gfx::GLSurfaceAdapter::PostSubBufferAsync(x, y, width, height, |
+ std::vector<ui::LatencyInfo> latency_info; |
+ latency_info.swap(latency_info_); |
brianderson
2015/05/14 19:06:12
Although this swap avoids one copy, I think there
alexst (slow to review)
2015/05/14 19:32:41
Sounds good, done.
|
+ return gfx::GLSurfaceAdapter::PostSubBufferAsync( |
+ x, y, width, height, |
base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, |
- weak_ptr_factory_.GetWeakPtr())); |
+ weak_ptr_factory_.GetWeakPtr(), latency_info)); |
} |
-void PassThroughImageTransportSurface::SwapBuffersCallBack() { |
+void PassThroughImageTransportSurface::SwapBuffersCallBack( |
+ std::vector<ui::LatencyInfo> latency_info) { |
base::TimeTicks swap_ack_time = base::TimeTicks::Now(); |
- for (auto& latency : latency_info_) { |
+ for (auto& latency : latency_info) { |
latency.AddLatencyNumberWithTimestamp( |
ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, |
swap_ack_time, 1); |
} |
- helper_->stub()->SendSwapBuffersCompleted(latency_info_); |
- latency_info_.clear(); |
+ helper_->stub()->SendSwapBuffersCompleted(latency_info); |
} |
bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |