#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
+class Canvas2DLayerBridgeTest;
+
namespace blink {
+
+class ImageBuffer;
class WebGraphicsContext3D;
class WebGraphicsContext3DProvider;
-}
-
-class Canvas2DLayerBridgeTest;
-
-namespace WebCore {
-class PLATFORM_EXPORT Canvas2DLayerBridge : public blink::WebExternalTextureLayerClient, public SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayerBridge>, public RefCounted<Canvas2DLayerBridge> {
+class PLATFORM_EXPORT Canvas2DLayerBridge : public WebExternalTextureLayerClient, public SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayerBridge>, public RefCounted<Canvas2DLayerBridge> {
WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge);
public:
static PassRefPtr<Canvas2DLayerBridge> create(const IntSize&, OpacityMode, int msaaSampleCount);
virtual ~Canvas2DLayerBridge();
- // blink::WebExternalTextureLayerClient implementation.
- virtual blink::WebGraphicsContext3D* context() OVERRIDE;
- virtual bool prepareMailbox(blink::WebExternalTextureMailbox*, blink::WebExternalBitmap*) OVERRIDE;
- virtual void mailboxReleased(const blink::WebExternalTextureMailbox&) OVERRIDE;
+ // WebExternalTextureLayerClient implementation.
+ virtual bool prepareMailbox(WebExternalTextureMailbox*, WebExternalBitmap*) OVERRIDE;
+ virtual void mailboxReleased(const WebExternalTextureMailbox&, bool lostResource) OVERRIDE;
// SkDeferredCanvas::NotificationClient implementation
virtual void prepareForDraw() OVERRIDE;
virtual void skippedPendingDrawCommands() OVERRIDE;
// ImageBufferSurface implementation
- void willUse();
+ void finalizeFrame();
+ void willAccessPixels();
SkCanvas* canvas() const { return m_canvas.get(); }
- bool isValid();
- blink::WebLayer* layer() const;
+ bool checkSurfaceValid();
+ bool restoreSurface();
+ WebLayer* layer() const;
Platform3DObject getBackingTexture();
bool isAccelerated() const { return true; }
void setIsHidden(bool);
+ void setImageBuffer(ImageBuffer* imageBuffer) { m_imageBuffer = imageBuffer; }
// Methods used by Canvas2DLayerManager
virtual size_t freeMemoryIfPossible(size_t); // virtual for mocking
void beginDestruction();
protected:
- Canvas2DLayerBridge(PassOwnPtr<blink::WebGraphicsContext3DProvider>, PassOwnPtr<SkDeferredCanvas>, int, OpacityMode);
+ Canvas2DLayerBridge(PassOwnPtr<WebGraphicsContext3DProvider>, PassOwnPtr<SkDeferredCanvas>, PassRefPtr<SkSurface>, int, OpacityMode);
void setRateLimitingEnabled(bool);
bool releasedMailboxHasExpired();
+ WebGraphicsContext3D* context();
OwnPtr<SkDeferredCanvas> m_canvas;
- OwnPtr<blink::WebExternalTextureLayer> m_layer;
- OwnPtr<blink::WebGraphicsContext3DProvider> m_contextProvider;
+ RefPtr<SkSurface> m_surface;
+ OwnPtr<WebExternalTextureLayer> m_layer;
+ OwnPtr<WebGraphicsContext3DProvider> m_contextProvider;
+ ImageBuffer* m_imageBuffer;
int m_msaaSampleCount;
size_t m_bytesAllocated;
bool m_didRecordDrawCommand;
- bool m_surfaceIsValid;
+ bool m_isSurfaceValid;
int m_framesPending;
int m_framesSinceMailboxRelease;
bool m_destructionInProgress;
};
struct MailboxInfo {
- blink::WebExternalTextureMailbox m_mailbox;
+ WebExternalTextureMailbox m_mailbox;
RefPtr<SkImage> m_image;
MailboxStatus m_status;
RefPtr<Canvas2DLayerBridge> m_parentLayerBridge;
Vector<MailboxInfo> m_mailboxes;
int m_releasedMailboxInfoIndex;
};
-}
+
+} // namespace blink
+
#endif