Chromium Code Reviews| Index: Source/core/platform/graphics/gpu/DrawingBuffer.h |
| diff --git a/Source/core/platform/graphics/gpu/DrawingBuffer.h b/Source/core/platform/graphics/gpu/DrawingBuffer.h |
| index 1d8c2b7a98cd3c69ffc81bcfd2a41f7f6ff26caf..f0b28371bef07dc3d302023a62103d2d96ce1088 100644 |
| --- a/Source/core/platform/graphics/gpu/DrawingBuffer.h |
| +++ b/Source/core/platform/graphics/gpu/DrawingBuffer.h |
| @@ -51,6 +51,15 @@ namespace WebCore { |
| class GraphicsContext3D; |
| class ImageData; |
| +// Abstract interface to allow basic context eviction management |
| +class ContextEvictionManager : public RefCounted<ContextEvictionManager> { |
| +public: |
| + virtual ~ContextEvictionManager() {}; |
| + |
| + virtual void forciblyLoseOldestContext() = 0; |
| + virtual IntSize oldestContextSize() = 0; |
| +}; |
| + |
| // Manages a rendering target (framebuffer + attachment) for a canvas. Can publish its rendering |
| // results to a PlatformLayer for compositing. |
| class DrawingBuffer : public RefCounted<DrawingBuffer>, public WebKit::WebExternalTextureLayerClient { |
| @@ -65,7 +74,7 @@ public: |
| Discard |
| }; |
| - static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&, PreserveDrawingBuffer); |
| + static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&, PreserveDrawingBuffer, ContextEvictionManager*); |
| ~DrawingBuffer(); |
| @@ -121,7 +130,7 @@ public: |
| private: |
| DrawingBuffer(GraphicsContext3D*, const IntSize&, bool multisampleExtensionSupported, |
| - bool packedDepthStencilExtensionSupported, PreserveDrawingBuffer); |
| + bool packedDepthStencilExtensionSupported, PreserveDrawingBuffer, ContextEvictionManager*); |
|
Ken Russell (switch to Gerrit)
2013/04/24 01:30:57
This should be PassRefPtr<ContextEvictionManager>.
|
| void initialize(const IntSize&); |
| @@ -152,6 +161,10 @@ private: |
| // Calculates the difference in pixels between the current buffer size and the proposed size. |
| int pixelDelta(const IntSize& size); |
| + // Given the desired buffer size, provides the largest dimensions that will fit in the pixel budget |
| + // Returns true if the buffer will only fit if the oldest WebGL context is forcibly lost |
| + IntSize adjustSizeWithContextEviction(const IntSize&, bool& evictContext); |
| + |
| PreserveDrawingBuffer m_preserveDrawingBuffer; |
| bool m_scissorEnabled; |
| Platform3DObject m_texture2DBinding; |
| @@ -192,6 +205,8 @@ private: |
| // Mailboxes that were released by the compositor and can be used again by this DrawingBuffer. |
| Vector<RefPtr<MailboxInfo> > m_recycledMailboxes; |
| RefPtr<MailboxInfo> m_lastColorBuffer; |
| + |
| + RefPtr<ContextEvictionManager> m_contextEvictionManager; |
| }; |
| } // namespace WebCore |