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

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

Issue 21858004: Refactoring Canvas2DLayerBridge to make it easier to write unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 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..5af548da89024e682540a442db26e484a208f7b4 100644
--- a/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
+++ b/Source/core/platform/graphics/chromium/Canvas2DLayerBridge.h
@@ -51,7 +51,13 @@ public:
NonOpaque
};
- static PassOwnPtr<Canvas2DLayerBridge> create(PassRefPtr<GraphicsContext3D>, const IntSize&, OpacityMode);
+ class Helper {
+ public:
+ virtual PassRefPtr<GraphicsContext3D> getContext() = 0;
+ virtual SkSurface* createSurface(GraphicsContext3D*, const IntSize&) = 0;
+ };
+
+ static PassOwnPtr<Canvas2DLayerBridge> create(PassOwnPtr<Helper>, const IntSize&, OpacityMode);
virtual ~Canvas2DLayerBridge();
@@ -76,23 +82,27 @@ public:
WebKit::WebLayer* layer();
void contextAcquired();
SkCanvas* getCanvas() { return m_canvas; }
+ Helper* helper() { return m_helper.get(); }
unsigned backBufferTexture();
bool isValid();
protected:
- Canvas2DLayerBridge(PassRefPtr<GraphicsContext3D>, SkDeferredCanvas*, OpacityMode);
+ Canvas2DLayerBridge(PassOwnPtr<Helper>, const IntSize&, OpacityMode, bool* success);
+
void setRateLimitingEnabled(bool);
SkDeferredCanvas* m_canvas;
OwnPtr<WebKit::WebExternalTextureLayer> m_layer;
RefPtr<GraphicsContext3D> m_context;
+ OwnPtr<Helper> m_helper;
size_t m_bytesAllocated;
bool m_didRecordDrawCommand;
bool m_surfaceIsValid;
int m_framesPending;
bool m_rateLimitingEnabled;
+ bool m_contentsDrawable;
friend class WTF::DoublyLinkedListNode<Canvas2DLayerBridge>;
Canvas2DLayerBridge* m_next;

Powered by Google App Engine
This is Rietveld 408576698