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

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

Issue 1866623002: Hook up CSSPaintValue::image to CSS Paint API callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments + rebase. 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/PaintWorkletGlobalScope.h
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.h b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.h
index cb0d416d59a40a502c618fec38d61420c1f7301c..e178f7e925be21de65935431a3b1ce5b376faa74 100644
--- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.h
+++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.h
@@ -9,10 +9,12 @@
#include "core/dom/ExecutionContext.h"
#include "modules/ModulesExport.h"
#include "modules/worklet/WorkletGlobalScope.h"
+#include "platform/graphics/ImageBuffer.h"
namespace blink {
class CSSPaintDefinition;
+class CSSPaintImageGeneratorImpl;
class ExceptionState;
class MODULES_EXPORT PaintWorkletGlobalScope : public WorkletGlobalScope {
@@ -26,6 +28,7 @@ public:
void registerPaint(const String& name, const ScriptValue& ctor, ExceptionState&);
CSSPaintDefinition* findDefinition(const String& name);
+ void addPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*);
DECLARE_VIRTUAL_TRACE();
@@ -34,6 +37,13 @@ private:
typedef HeapHashMap<String, Member<CSSPaintDefinition>> DefinitionMap;
DefinitionMap m_paintDefinitions;
+
+ // The map of CSSPaintImageGeneratorImpl which are waiting for a
+ // CSSPaintDefinition to be registered. The global scope is expected to
+ // outlive the generators hence are held onto with a WeakMember.
+ typedef HeapHashSet<WeakMember<CSSPaintImageGeneratorImpl>> GeneratorHashSet;
+ typedef HeapHashMap<String, Member<GeneratorHashSet>> PendingGeneratorMap;
+ PendingGeneratorMap m_pendingGenerators;
};
DEFINE_TYPE_CASTS(PaintWorkletGlobalScope, ExecutionContext, context, context->isPaintWorkletGlobalScope(), context.isPaintWorkletGlobalScope());

Powered by Google App Engine
This is Rietveld 408576698