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

Unified Diff: content/browser/compositor/io_surface_layer_mac.h

Issue 511923004: Simplify IOSurface CoreAnimation code: Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use accessors Created 6 years, 4 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/browser/compositor/io_surface_layer_mac.h
diff --git a/content/browser/renderer_host/compositing_iosurface_layer_mac.h b/content/browser/compositor/io_surface_layer_mac.h
similarity index 69%
rename from content/browser/renderer_host/compositing_iosurface_layer_mac.h
rename to content/browser/compositor/io_surface_layer_mac.h
index a01b6fc125ce6fa609b61c09ce6a7a8337a5e0bc..83a6e43640b3a752d2e6124bf1dea7bb2dda6dac 100644
--- a/content/browser/renderer_host/compositing_iosurface_layer_mac.h
+++ b/content/browser/compositor/io_surface_layer_mac.h
@@ -10,53 +10,54 @@
#include "base/mac/scoped_cftyperef.h"
#include "base/memory/ref_counted.h"
#include "base/timer/timer.h"
+#include "ui/gfx/size.h"
-@class CompositingIOSurfaceLayer;
+@class IOSurfaceLayer;
namespace content {
class CompositingIOSurfaceMac;
class CompositingIOSurfaceContext;
-// The interface through which the CompositingIOSurfaceLayer calls back into
+// The interface through which the IOSurfaceLayer calls back into
// the structrue that created it (RenderWidgetHostViewMac or
// BrowserCompositorViewMac).
-class CompositingIOSurfaceLayerClient {
+class IOSurfaceLayerClient {
public:
// Used to indicate that the layer should attempt to draw immediately and
// should (even if the draw is elided by the system), ack the frame
// immediately.
- virtual bool AcceleratedLayerShouldAckImmediately() const = 0;
+ virtual bool IOSurfaceLayerShouldAckImmediately() const = 0;
// Called when a frame is drawn or when, because the layer is not visible, it
// is known that the frame will never drawn.
- virtual void AcceleratedLayerDidDrawFrame() = 0;
+ virtual void IOSurfaceLayerDidDrawFrame() = 0;
// Called when an error prevents the frame from being drawn.
- virtual void AcceleratedLayerHitError() = 0;
+ virtual void IOSurfaceLayerHitError() = 0;
};
-// CompositingIOSurfaceLayerHelper provides C++ functionality needed for the
-// CompositingIOSurfaceLayer class, and does most of the heavy lifting for the
+// IOSurfaceLayerHelper provides C++ functionality needed for the
+// IOSurfaceLayer class, and does most of the heavy lifting for the
// class.
-// TODO(ccameron): This class should own CompositingIOSurfaceLayer, rather than
+// TODO(ccameron): This class should own IOSurfaceLayer, rather than
// vice versa.
-class CompositingIOSurfaceLayerHelper {
+class IOSurfaceLayerHelper {
public:
- CompositingIOSurfaceLayerHelper(CompositingIOSurfaceLayerClient* client,
- CompositingIOSurfaceLayer* layer);
- ~CompositingIOSurfaceLayerHelper();
+ IOSurfaceLayerHelper(IOSurfaceLayerClient* client,
+ IOSurfaceLayer* layer);
+ ~IOSurfaceLayerHelper();
- // Called when the CompositingIOSurfaceLayer gets a new frame.
+ // Called when the IOSurfaceLayer gets a new frame.
void GotNewFrame();
- // Called whenever -[CompositingIOSurfaceLayer setNeedsDisplay] is called.
+ // Called whenever -[IOSurfaceLayer setNeedsDisplay] is called.
void SetNeedsDisplay();
- // Called whenever -[CompositingIOSurfaceLayer canDrawInCGLContext] is called,
+ // Called whenever -[IOSurfaceLayer canDrawInCGLContext] is called,
// to determine if a new frame should be drawn.
bool CanDraw();
- // Called whenever -[CompositingIOSurfaceLayer drawInCGLContext] draws a
+ // Called whenever -[IOSurfaceLayer drawInCGLContext] draws a
// frame.
void DidDraw(bool success);
@@ -83,10 +84,10 @@ class CompositingIOSurfaceLayerHelper {
void TimerFired();
// The client that the owning layer was created with.
- content::CompositingIOSurfaceLayerClient* const client_;
+ content::IOSurfaceLayerClient* const client_;
// The layer that owns this helper.
- CompositingIOSurfaceLayer* const layer_;
+ IOSurfaceLayer* const layer_;
// 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
@@ -107,27 +108,35 @@ class CompositingIOSurfaceLayerHelper {
// 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.
- base::DelayTimer<CompositingIOSurfaceLayerHelper> timer_;
+ base::DelayTimer<IOSurfaceLayerHelper> timer_;
};
} // namespace content
// The CoreAnimation layer for drawing accelerated content.
-@interface CompositingIOSurfaceLayer : CAOpenGLLayer {
+@interface IOSurfaceLayer : CAOpenGLLayer {
@private
scoped_refptr<content::CompositingIOSurfaceMac> iosurface_;
scoped_refptr<content::CompositingIOSurfaceContext> context_;
- scoped_ptr<content::CompositingIOSurfaceLayerHelper> helper_;
+ scoped_ptr<content::IOSurfaceLayerHelper> helper_;
}
-- (content::CompositingIOSurfaceMac*)iosurface;
-- (content::CompositingIOSurfaceContext*)context;
+- (id)initWithClient:(content::IOSurfaceLayerClient*)client
+ withScaleFactor:(float)scale_factor;
-- (id)initWithIOSurface:(scoped_refptr<content::CompositingIOSurfaceMac>)
- iosurface
- withScaleFactor:(float)scale_factor
- withClient:(content::CompositingIOSurfaceLayerClient*)client;
+- (bool)gotFrameWithIOSurface:(IOSurfaceID)io_surface_id
+ withPixelSize:(gfx::Size)pixel_size
+ withScaleFactor:(float)scale_factor;
+
+// Context poison accessors.
+- (void)poisonContextAndSharegroup;
+- (bool)hasBeenPoisoned;
+
+- (float)scaleFactor;
+
+// The CGL renderer ID.
+- (int)rendererID;
// Mark that the client is no longer valid and cannot be called back into. This
// must be called before the layer is destroyed.
« no previous file with comments | « content/browser/compositor/browser_compositor_view_private_mac.mm ('k') | content/browser/compositor/io_surface_layer_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698