Chromium Code Reviews| Index: third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h |
| diff --git a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h |
| index 0d183732ce06945914be4d6e39ce20e003e7b391..38fa2dddeaa72f8136d9897b77377786cd46da8d 100644 |
| --- a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h |
| +++ b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h |
| @@ -12,13 +12,27 @@ |
| namespace blink { |
| +class Image; |
| class ScriptState; |
| +// Represents a javascript class registered on the PaintWorkletGlobalScope by |
| +// the author. |
| class CSSPaintDefinition final : public GarbageCollectedFinalized<CSSPaintDefinition> { |
| public: |
| static CSSPaintDefinition* create(ScriptState*, v8::Local<v8::Function> constructor, v8::Local<v8::Function> paint); |
| virtual ~CSSPaintDefinition(); |
| + // Invokes the javascript 'paint' callback on an instance of the javascript |
| + // class. The size given will be the size of the PaintRenderingContext2D |
| + // given to the callback. |
| + // |
| + // This may return a nullptr (representing an invalid image) if javascript |
| + // throws an error. |
| + PassRefPtr<Image> paint(const IntSize&); |
| + |
| + v8::Local<v8::Object> paintInstance(); |
| + ScriptState* getScriptState() const { return m_scriptState.get(); } |
| + |
| v8::Local<v8::Function> paintFunctionForTesting(v8::Isolate* isolate) { return m_paint.newLocal(isolate); } |
| DEFINE_INLINE_TRACE() { }; |
| @@ -33,6 +47,11 @@ private: |
| // PaintWorkletGlobalScope. |
| ScopedPersistent<v8::Function> m_constructor; |
| ScopedPersistent<v8::Function> m_paint; |
| + |
| + // At the moment there is only ever one instance of a paint class per type. |
| + // This is a weak reference, CSSPaintImageGeneratorImpl holds a persistent |
| + // reference which keeps it alive. |
| + ScopedPersistent<v8::Object> m_instance; |
|
haraken
2016/04/08 04:31:19
I guess it's a bit nasty to add m_instance to both
ikilpatrick
2016/04/08 18:43:21
The initial thinking was when a CSSPaintValue was
|
| }; |
| } // namespace blink |