Index: content/browser/renderer_host/compositing_iosurface_layer_mac.h |
diff --git a/content/browser/renderer_host/compositing_iosurface_layer_mac.h b/content/browser/renderer_host/compositing_iosurface_layer_mac.h |
index 9b1b6aa3f8d9cfdc56263894ab4812e8b140aedc..80a152dd35c0cb4b92161fe732f492f6415f3de4 100644 |
--- a/content/browser/renderer_host/compositing_iosurface_layer_mac.h |
+++ b/content/browser/renderer_host/compositing_iosurface_layer_mac.h |
@@ -9,15 +9,16 @@ |
#include "base/mac/scoped_cftyperef.h" |
#include "base/memory/ref_counted.h" |
+#include "base/timer/timer.h" |
namespace content { |
class CompositingIOSurfaceMac; |
class CompositingIOSurfaceContext; |
+class CompositingIOSurfaceLayerHelper; |
class CompositingIOSurfaceLayerClient { |
public: |
virtual void AcceleratedLayerDidDrawFrame(bool succeeded) = 0; |
- virtual bool AcceleratedLayerHasNotAckedPendingFrame() const = 0; |
}; |
} |
@@ -29,11 +30,21 @@ class CompositingIOSurfaceLayerClient { |
scoped_refptr<content::CompositingIOSurfaceMac> iosurface_; |
scoped_refptr<content::CompositingIOSurfaceContext> context_; |
+ // The browser places back-pressure on the GPU by not acknowledging swap |
+ // calls until they appear on the screen. This can lead to hangs if the |
+ // view is moved offscreen (among other things). Prevent hangs by always |
+ // acknowledging the frame after timeout of 1/6th of a second has passed. |
+ scoped_ptr<content::CompositingIOSurfaceLayerHelper> helper_; |
+ scoped_ptr<base::DelayTimer<content::CompositingIOSurfaceLayerHelper>> timer_; |
+ |
// Used to track when canDrawInCGLContext should return YES. This can be |
// in response to receiving a new compositor frame, or from any of the events |
// that cause setNeedsDisplay to be called on the layer. |
BOOL needs_display_; |
+ // This is set when a frame is received, and un-set when the frame is drawn. |
+ BOOL has_pending_frame_; |
+ |
// Incremented every time that this layer is asked to draw but does not have |
// new content to draw. |
uint64 did_not_draw_counter_; |