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

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

Issue 117703004: Free temporary GPU and memory resources held by inactive or hidden 2D canvases (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: typo Created 6 years, 11 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/platform/graphics/Canvas2DLayerBridge.h
diff --git a/Source/platform/graphics/Canvas2DLayerBridge.h b/Source/platform/graphics/Canvas2DLayerBridge.h
index d259c5fcd9d678c4bc10e7f701853ece552f9247..1687eb42f3ea1cd97f7fbcbec92574a896794bd3 100644
--- a/Source/platform/graphics/Canvas2DLayerBridge.h
+++ b/Source/platform/graphics/Canvas2DLayerBridge.h
@@ -52,6 +52,7 @@ class PLATFORM_EXPORT Canvas2DLayerBridge : public blink::WebExternalTextureLaye
WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge);
public:
static PassRefPtr<Canvas2DLayerBridge> create(const IntSize&, OpacityMode, int msaaSampleCount);
+
virtual ~Canvas2DLayerBridge();
// blink::WebExternalTextureLayerClient implementation.
@@ -72,19 +73,26 @@ public:
blink::WebLayer* layer() const;
Platform3DObject getBackingTexture();
bool isAccelerated() const { return true; }
+ void setIsHidden(bool);
// Methods used by Canvas2DLayerManager
virtual size_t freeMemoryIfPossible(size_t); // virtual for mocking
virtual void flush(); // virtual for mocking
virtual size_t storageAllocatedForRecording(); // virtual for faking
- size_t bytesAllocated() const {return m_bytesAllocated;}
+ size_t bytesAllocated() const { return m_bytesAllocated; }
void limitPendingFrames();
+ void freeReleasedMailbox();
+ bool hasReleasedMailbox() const { return m_releasedMailboxInfo; };
+ void freeTransientResources();
+ bool hasTransientResources() const;
+ bool isHidden() { return m_isHidden; }
void beginDestruction();
protected:
Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, PassOwnPtr<SkDeferredCanvas>, int, OpacityMode);
void setRateLimitingEnabled(bool);
+ bool releasedMailboxHasExpired();
OwnPtr<SkDeferredCanvas> m_canvas;
OwnPtr<blink::WebExternalTextureLayer> m_layer;
@@ -94,8 +102,10 @@ protected:
bool m_didRecordDrawCommand;
bool m_surfaceIsValid;
int m_framesPending;
+ int m_framesSinceMailboxRelease;
bool m_destructionInProgress;
bool m_rateLimitingEnabled;
+ bool m_isHidden;
friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>;
friend class ::Canvas2DLayerBridgeTest;
@@ -110,7 +120,7 @@ protected:
struct MailboxInfo {
blink::WebExternalTextureMailbox m_mailbox;
- SkAutoTUnref<SkImage> m_image;
+ RefPtr<SkImage> m_image;
MailboxStatus m_status;
RefPtr<Canvas2DLayerBridge> m_parentLayerBridge;
@@ -121,6 +131,7 @@ protected:
uint32_t m_lastImageId;
Vector<MailboxInfo> m_mailboxes;
+ MailboxInfo* m_releasedMailboxInfo;
};
}
#endif
« no previous file with comments | « Source/platform/graphics/Canvas2DImageBufferSurface.h ('k') | Source/platform/graphics/Canvas2DLayerBridge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698