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

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

Issue 22929012: Change Canvas2DLayerBridge to stay alive until last mailbox is returned. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing unit tests Created 7 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: Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
diff --git a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
index 12f87fa0f0dd9af0e2c5a6eb8c314d46ec4bd97f..658a739e82102e7cef3baa1e35d7e4bf8b5ca048 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
@@ -43,7 +43,7 @@ class WebGraphicsContext3D;
namespace WebCore {
-class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayerBridge> {
+class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayerBridge>, public RefCounted<Canvas2DLayerBridge> {
WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge);
public:
enum OpacityMode {
@@ -51,7 +51,7 @@ public:
NonOpaque
};
- static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode);
+ static PassRefPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode);
virtual ~Canvas2DLayerBridge();
@@ -81,9 +81,13 @@ public:
bool isValid();
+ // Non-virtual overload of RefCounted::deref. RefPtr calls this one.
+ void deref();
+
protected:
Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, OpacityMode);
void setRateLimitingEnabled(bool);
+ bool isDead();
SkDeferredCanvas* m_canvas;
OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
@@ -92,6 +96,8 @@ protected:
bool m_didRecordDrawCommand;
bool m_surfaceIsValid;
int m_framesPending;
+ int m_liveMailboxCount;
+ bool m_destructionInProgress;
bool m_rateLimitingEnabled;
friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>;
@@ -108,6 +114,7 @@ protected:
WebKit::WebExternalTextureMailbox m_mailbox;
SkAutoTUnref<SkImage> m_image;
MailboxStatus m_status;
+ RefPtr<Canvas2DLayerBridge> m_parentLayerBridge;
MailboxInfo(const MailboxInfo&);
MailboxInfo() {}

Powered by Google App Engine
This is Rietveld 408576698