 Chromium Code Reviews
 Chromium Code Reviews Issue 22929012:
  Change Canvas2DLayerBridge to stay alive until last mailbox is returned.  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 22929012:
  Change Canvas2DLayerBridge to stay alive until last mailbox is returned.  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| 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..68299b66593710442f8e6ab09c6cca4ce8c053dc 100644 | 
| --- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h | 
| +++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h | 
| @@ -43,7 +43,24 @@ class WebGraphicsContext3D; | 
| namespace WebCore { | 
| -class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayerBridge> { | 
| +class Canvas2DLayerBridge; | 
| + | 
| +class Canvas2DLayerBridgePtr { | 
| +public: | 
| + Canvas2DLayerBridgePtr() { } | 
| + Canvas2DLayerBridgePtr(PassRefPtr<Canvas2DLayerBridge> ptr) { m_ptr = ptr; } | 
| + Canvas2DLayerBridgePtr(const Canvas2DLayerBridgePtr&); | 
| + ~Canvas2DLayerBridgePtr() { clear(); } | 
| + Canvas2DLayerBridge* operator->() const { return m_ptr.get(); } | 
| + Canvas2DLayerBridgePtr& operator=(const Canvas2DLayerBridgePtr&); | 
| + Canvas2DLayerBridge* get() const { return m_ptr.get(); } | 
| + operator bool () const { return m_ptr; } | 
| + void clear(); | 
| 
Stephen White
2013/08/23 14:45:28
Nit: looks like this function is only called from
 | 
| +private: | 
| + RefPtr<Canvas2DLayerBridge> m_ptr; | 
| +}; | 
| + | 
| +class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient, public SkDeferredCanvas::NotificationClient, public DoublyLinkedListNode<Canvas2DLayerBridge>, public RefCounted<Canvas2DLayerBridge> { | 
| WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); | 
| public: | 
| enum OpacityMode { | 
| @@ -51,7 +68,7 @@ public: | 
| NonOpaque | 
| }; | 
| - static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode); | 
| + static Canvas2DLayerBridgePtr create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode); | 
| virtual ~Canvas2DLayerBridge(); | 
| @@ -81,9 +98,13 @@ public: | 
| bool isValid(); | 
| + // Non-virtual overload of RefCounted::deref. RefPtr calls this one. | 
| 
Stephen White
2013/08/23 14:45:28
Nit: stale comment?
 | 
| + void destroy(); | 
| + | 
| protected: | 
| Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, OpacityMode); | 
| void setRateLimitingEnabled(bool); | 
| + bool isDead(); | 
| 
Stephen White
2013/08/23 14:45:28
This doesn't seem to be defined anywhere.
 | 
| SkDeferredCanvas* m_canvas; | 
| OwnPtr<WebKit::WebExternalTextureLayer> m_layer; | 
| @@ -92,6 +113,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 +131,7 @@ protected: | 
| WebKit::WebExternalTextureMailbox m_mailbox; | 
| SkAutoTUnref<SkImage> m_image; | 
| MailboxStatus m_status; | 
| + RefPtr<Canvas2DLayerBridge> m_parentLayerBridge; | 
| MailboxInfo(const MailboxInfo&); | 
| MailboxInfo() {} | 
| @@ -117,7 +141,5 @@ protected: | 
| uint32_t m_lastImageId; | 
| Vector<MailboxInfo> m_mailboxes; | 
| }; | 
| - | 
| } | 
| - | 
| #endif |