Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: content/common/gpu/image_transport_surface_calayer_mac.h

Issue 636003002: Clean up GPU back-pressure with remote CALayers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better variable names Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 20ccce35cee59b5f0b79d692e0e115c32d49c1e1..a7584ff2370cf4fa1782d8b9b27679c4071c6985 100644
--- a/content/common/gpu/image_transport_surface_calayer_mac.h
+++ b/content/common/gpu/image_transport_surface_calayer_mac.h
@@ -31,7 +31,7 @@ class CALayerStorageProvider
virtual void SwapBuffers(const gfx::Size& size, float scale_factor) override;
virtual void WillWriteToBackbuffer() override;
virtual void DiscardBackbuffer() override;
- virtual void SwapBuffersAckedByBrowser() override;
+ virtual void SwapBuffersAckedByBrowser(bool disable_throttling) override;
// Interface to ImageTransportLayer:
CGLContextObj LayerShareGroupContext();
@@ -40,8 +40,11 @@ class CALayerStorageProvider
void LayerResetStorageProvider();
private:
- void DrawWithVsyncDisabled();
- void SendPendingSwapToBrowserAfterFrameDrawn();
+ void DrawImmediatelyAndUnblockBrowser();
+
+ // The browser will be blocked while there is a frame that was sent to it but
+ // hasn't drawn yet. This call will un-block the browser.
+ void UnblockBrowserIfNeeded();
ImageTransportSurfaceFBO* transport_surface_;
@@ -49,9 +52,16 @@ class CALayerStorageProvider
// animate.
const bool gpu_vsync_disabled_;
+ // Used also to determine if we should wait for CoreAnimation to call our
+ // drawInCGLContext, or if we should force it with displayIfNeeded.
+ bool throttling_disabled_;
+
// Set when a new swap occurs, and un-set when |layer_| draws that frame.
bool has_pending_draw_;
+ // Weak factory against which a timeout task for forcing a draw is created.
+ base::WeakPtrFactory<CALayerStorageProvider> pending_draw_weak_factory_;
piman 2014/10/08 01:22:15 Why not keep as last member? It's usually done to
ccameron 2014/10/08 18:44:00 Moved back (thought to put it next to pending_draw
+
// A counter that is incremented whenever LayerCanDraw returns false. If this
// reaches a threshold, then |layer_| is switched to synchronous drawing to
// save CPU work.
@@ -68,7 +78,6 @@ class CALayerStorageProvider
base::scoped_nsobject<CAContext> context_;
base::scoped_nsobject<ImageTransportLayer> layer_;
- base::WeakPtrFactory<CALayerStorageProvider> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CALayerStorageProvider);
};

Powered by Google App Engine
This is Rietveld 408576698