Index: content/common/gpu/image_transport_surface_iosurface_mac.cc |
diff --git a/content/common/gpu/image_transport_surface_iosurface_mac.cc b/content/common/gpu/image_transport_surface_iosurface_mac.cc |
index 49aa4cda74dbc32fe7e271bb617d344723c7a43c..cbae4a2612535fddbfa8dfaef2f01a5a1254b5e1 100644 |
--- a/content/common/gpu/image_transport_surface_iosurface_mac.cc |
+++ b/content/common/gpu/image_transport_surface_iosurface_mac.cc |
@@ -40,7 +40,9 @@ void AddIntegerValue(CFMutableDictionaryRef dictionary, |
} // namespace |
-IOSurfaceStorageProvider::IOSurfaceStorageProvider() {} |
+IOSurfaceStorageProvider::IOSurfaceStorageProvider( |
+ ImageTransportSurfaceFBO* transport_surface) |
+ : transport_surface_(transport_surface) {} |
IOSurfaceStorageProvider::~IOSurfaceStorageProvider() { |
DCHECK(!io_surface_); |
@@ -108,6 +110,18 @@ uint64 IOSurfaceStorageProvider::GetSurfaceHandle() const { |
} |
void IOSurfaceStorageProvider::WillSwapBuffers() { |
+ // The browser compositor will throttle itself, so we are free to unblock the |
+ // context immediately. Make sure that the browser is doing its throttling |
+ // appropriately by ensuring that the previous swap was acknowledged before |
+ // we get another swap. |
+ DCHECK(pending_swapped_surfaces_.empty()); |
+ pending_swapped_surfaces_.push_back(io_surface_); |
+ transport_surface_->UnblockContextAfterPendingSwap(); |
+} |
+ |
+void IOSurfaceStorageProvider::CanFreeSwappedBuffer() { |
+ DCHECK(!pending_swapped_surfaces_.empty()); |
+ pending_swapped_surfaces_.pop_front(); |
} |
} // namespace content |