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

Unified Diff: Source/core/platform/graphics/Canvas2DLayerBridge.h

Issue 104023007: Refactoring ImageBuffer to decouple it from Canvas2DLayerBridge (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fixes for win+mac Created 7 years 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: Source/core/platform/graphics/Canvas2DLayerBridge.h
diff --git a/Source/core/platform/graphics/Canvas2DLayerBridge.h b/Source/core/platform/graphics/Canvas2DLayerBridge.h
index 9cc266440117636cf5a7e903019ebcdd6c994ce4..2bde60849ec01b6055d04f0d73f7b36e22ea7b0d 100644
--- a/Source/core/platform/graphics/Canvas2DLayerBridge.h
+++ b/Source/core/platform/graphics/Canvas2DLayerBridge.h
@@ -30,6 +30,7 @@
#include "SkImage.h"
#include "core/platform/graphics/GraphicsContext3D.h"
#include "platform/geometry/IntSize.h"
+#include "platform/graphics/ImageBufferSurface.h"
#include "public/platform/WebExternalTextureLayer.h"
#include "public/platform/WebExternalTextureLayerClient.h"
#include "public/platform/WebExternalTextureMailbox.h"
@@ -43,34 +44,10 @@ class WebGraphicsContext3D;
namespace WebCore {
-class Canvas2DLayerBridge;
-class PassCanvas2DLayerBridgePtr;
-
-class Canvas2DLayerBridgePtr {
-public:
- Canvas2DLayerBridgePtr() { }
- Canvas2DLayerBridgePtr(const PassRefPtr<Canvas2DLayerBridge>& ptr) { m_ptr = ptr; }
- ~Canvas2DLayerBridgePtr() { clear(); }
- Canvas2DLayerBridge* operator->() const { return m_ptr.get(); }
- Canvas2DLayerBridgePtr& operator=(const PassRefPtr<Canvas2DLayerBridge>&);
- Canvas2DLayerBridge* get() const { return m_ptr.get(); }
- operator bool () const { return m_ptr; }
- void clear();
- PassRefPtr<Canvas2DLayerBridge> release() WARN_UNUSED_RETURN { return m_ptr.release(); }
-private:
- RefPtr<Canvas2DLayerBridge> m_ptr;
-};
-
class Canvas2DLayerBridge : public blink::WebExternalTextureLayerClient, public SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayerBridge>, public RefCounted<Canvas2DLayerBridge> {
WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge);
public:
- enum OpacityMode {
- Opaque,
- NonOpaque
- };
-
- static PassRefPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode, int msaaSampleCount);
-
+ static PassRefPtr<Canvas2DLayerBridge> create(const IntSize&, OpacityMode, int msaaSampleCount);
virtual ~Canvas2DLayerBridge();
// blink::WebExternalTextureLayerClient implementation.
@@ -84,6 +61,14 @@ public:
virtual void flushedDrawCommands() OVERRIDE;
virtual void skippedPendingDrawCommands() OVERRIDE;
+ // ImageBufferSurface implementation
+ void aboutToUse();
+ SkCanvas* canvas() const { return m_canvas.get(); }
+ bool isValid();
+ blink::WebLayer* layer() const;
+ Platform3DObject getBackingTexture();
+ bool isAccelerated() const { return true; }
+
// Methods used by Canvas2DLayerManager
virtual size_t freeMemoryIfPossible(size_t); // virtual for mocking
virtual void flush(); // virtual for mocking
@@ -91,21 +76,13 @@ public:
size_t bytesAllocated() const {return m_bytesAllocated;}
void limitPendingFrames();
- blink::WebLayer* layer();
- void contextAcquired();
- PassRefPtr<SkCanvas> getCanvas() { return PassRefPtr<SkCanvas>(m_canvas); }
-
- unsigned backBufferTexture();
-
- bool isValid();
+ void destroy();
protected:
- void destroy();
- friend class Canvas2DLayerBridgePtr;
- Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, PassRefPtr<SkDeferredCanvas>, int, OpacityMode);
+ Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, PassOwnPtr<SkDeferredCanvas>, int, OpacityMode);
void setRateLimitingEnabled(bool);
- RefPtr<SkDeferredCanvas> m_canvas;
+ OwnPtr<SkDeferredCanvas> m_canvas;
OwnPtr<blink::WebExternalTextureLayer> m_layer;
RefPtr<GraphicsContext3D> m_context;
int m_msaaSampleCount;

Powered by Google App Engine
This is Rietveld 408576698