Index: content/common/gpu/image_transport_surface_calayer_mac.h |
diff --git a/content/common/gpu/image_transport_surface_calayer_mac.h b/content/common/gpu/image_transport_surface_calayer_mac.h |
index 85ee4181a3a33c82e46c6c9b4a825cdd5a36817c..dbea6ae947710f145f3ebdc3482eaa8f328ee561 100644 |
--- a/content/common/gpu/image_transport_surface_calayer_mac.h |
+++ b/content/common/gpu/image_transport_surface_calayer_mac.h |
@@ -28,18 +28,26 @@ class CALayerStorageProvider |
CGLContextObj context, GLuint texture, |
gfx::Size pixel_size, float scale_factor) OVERRIDE; |
virtual void FreeColorBufferStorage() OVERRIDE; |
- virtual uint64 GetSurfaceHandle() const OVERRIDE; |
- virtual void WillSwapBuffers() OVERRIDE; |
+ virtual void DiscardBackbuffer() OVERRIDE; |
+ virtual uint64 SwapBuffersAndGetSurfaceHandle() OVERRIDE; |
virtual void CanFreeSwappedBuffer() OVERRIDE; |
// Interface to ImageTransportLayer: |
CGLContextObj LayerShareGroupContext(); |
bool LayerCanDraw(); |
void LayerDoDraw(); |
+ void LayerResetStorageProvider(); |
private: |
+ void DisplayTimeoutFired(); |
+ void UnblockIfNeededAfterPendingFrameDrawn(); |
+ |
ImageTransportSurfaceFBO* transport_surface_; |
+ // Used to determine if we should use setNeedsDisplay or setAsynchronous to |
+ // animate. |
+ const bool gpu_vsync_disabled_; |
+ |
// Set when a new swap occurs, and un-set when |layer_| draws that frame. |
bool has_pending_draw_; |
@@ -53,11 +61,19 @@ class CALayerStorageProvider |
base::ScopedTypeRef<CGLContextObj> share_group_context_; |
GLuint fbo_texture_; |
gfx::Size fbo_pixel_size_; |
+ float fbo_scale_factor_; |
// The CALayer that the current frame is being drawn into. |
base::scoped_nsobject<CAContext> context_; |
base::scoped_nsobject<ImageTransportLayer> layer_; |
+ // CoreAnimation places back-pressure on the browser compositor (which then |
+ // places back-pressure on the renderer) by by descheduling the command buffer |
+ // until CoreAnimation tells us it's time to draw. Sometimes this callback is |
+ // simply skipped, which can lead to hangs. Prevent hangs by always |
+ // acknowledging the frame after timeout of 1/6th of a second has passed. |
+ base::DelayTimer<CALayerStorageProvider> display_timeout_timer_; |
+ |
DISALLOW_COPY_AND_ASSIGN(CALayerStorageProvider); |
}; |