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

Unified Diff: third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h

Issue 1834843002: [WIP] Plumbing for paint Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: 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 9c768b7377e226930b370f2b949be40d199d3c6b..22455961711e5909ceda7688be2d6eb4c82b017e 100644
--- a/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h
+++ b/third_party/WebKit/Source/modules/csspaint/CSSPaintDefinition.h
@@ -12,6 +12,7 @@
namespace blink {
+class Image;
class ScriptState;
class CSSPaintDefinition final : public GarbageCollectedFinalized<CSSPaintDefinition> {
@@ -19,6 +20,10 @@ public:
static RawPtr<CSSPaintDefinition> create(ScriptState*, v8::Local<v8::Function> constructor, v8::Local<v8::Function> paint);
virtual ~CSSPaintDefinition();
+ 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() { };
@@ -26,6 +31,7 @@ public:
private:
CSSPaintDefinition(ScriptState*, v8::Local<v8::Function> constructor, v8::Local<v8::Function> paint);
+
RefPtr<ScriptState> m_scriptState;
// This object keeps the constructor and paint functions alive. This object
@@ -33,6 +39,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
+ // so we store it here. If this changes, instance should be passed into the
+ // callback. m_instance is lazily constructed.
+ ScopedPersistent<v8::Object> m_instance;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698