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 f4c5a68cb218b02b354c2612ec7f3b18b4e89b63..8d2747c8952a4e6385722f52bf1711574bf79212 100644 |
--- a/content/common/gpu/image_transport_surface.cc |
+++ b/content/common/gpu/image_transport_surface.cc |
@@ -213,21 +213,20 @@ bool PassThroughImageTransportSurface::SwapBuffers() { |
// GetVsyncValues before SwapBuffers to work around Mali driver bug: |
// crbug.com/223558. |
SendVSyncUpdateIfAvailable(); |
- bool result = gfx::GLSurfaceAdapter::SwapBuffers(); |
- for (size_t i = 0; i < latency_info_.size(); i++) { |
- latency_info_[i].AddLatencyNumber( |
- ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); |
- } |
- |
- helper_->SwapBuffersCompleted(latency_info_); |
- latency_info_.clear(); |
- return result; |
+ return gfx::GLSurfaceAdapter::SwapBuffersAsync( |
+ base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, |
+ base::Unretained(this))); |
piman
2014/12/19 04:10:36
Why is Unretained safe? Can you add a comment?
kalyank
2014/12/19 08:43:03
Weakptr has a requirement that the callback be pos
piman
2014/12/19 20:32:54
Right, that's a strong requirement. It wouldn't be
|
} |
bool PassThroughImageTransportSurface::PostSubBuffer( |
int x, int y, int width, int height) { |
SendVSyncUpdateIfAvailable(); |
- bool result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); |
+ return gfx::GLSurfaceAdapter::PostSubBufferAsync(x, y, width, height, |
+ base::Bind(&PassThroughImageTransportSurface::SwapBuffersCallBack, |
+ base::Unretained(this))); |
piman
2014/12/19 04:10:36
same thing here wrt Unretained.
|
+} |
+ |
+void PassThroughImageTransportSurface::SwapBuffersCallBack() { |
for (size_t i = 0; i < latency_info_.size(); i++) { |
latency_info_[i].AddLatencyNumber( |
ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0); |
@@ -235,7 +234,6 @@ bool PassThroughImageTransportSurface::PostSubBuffer( |
helper_->SwapBuffersCompleted(latency_info_); |
latency_info_.clear(); |
- return result; |
} |
bool PassThroughImageTransportSurface::OnMakeCurrent(gfx::GLContext* context) { |