| Index: third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
|
| diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
|
| index 03503342e5afa6bc554bc70e952b9c018eca54cb..47cccba254fe4252206290cde8257a46f5badd05 100644
|
| --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
|
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
|
| @@ -10,6 +10,10 @@
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/inspector/MainThreadDebugger.h"
|
| #include "modules/csspaint/CSSPaintDefinition.h"
|
| +#include "modules/csspaint/CSSPaintImageGeneratorImpl.h"
|
| +#include "platform/graphics/ImageBuffer.h"
|
| +#include "platform/graphics/ImageBufferSurface.h"
|
| +#include "platform/graphics/RecordingImageBufferSurface.h"
|
|
|
| namespace blink {
|
|
|
| @@ -103,8 +107,19 @@ void PaintWorkletGlobalScope::registerPaint(const String& name, const ScriptValu
|
|
|
| v8::Local<v8::Function> paint = v8::Local<v8::Function>::Cast(paintValue);
|
|
|
| - RawPtr<CSSPaintDefinition> definition = CSSPaintDefinition::create(scriptController()->getScriptState(), constructor, paint);
|
| + CSSPaintDefinition* definition = CSSPaintDefinition::create(scriptController()->getScriptState(), constructor, paint);
|
| m_paintDefinitions.set(name, definition);
|
| +
|
| + // Set the definition on any pending generators.
|
| + Member<GeneratorHashSet> set = m_pendingGenerators.get(name);
|
| + if (set) {
|
| + for (const WeakMember<CSSPaintImageGeneratorImpl> generator : *set) {
|
| + if (generator) {
|
| + generator->setDefinition(definition);
|
| + }
|
| + }
|
| + }
|
| + m_pendingGenerators.remove(name);
|
| }
|
|
|
| CSSPaintDefinition* PaintWorkletGlobalScope::findDefinition(const String& name)
|
| @@ -112,9 +127,18 @@ CSSPaintDefinition* PaintWorkletGlobalScope::findDefinition(const String& name)
|
| return m_paintDefinitions.get(name);
|
| }
|
|
|
| +void PaintWorkletGlobalScope::addPendingGenerator(const String& name, CSSPaintImageGeneratorImpl* generator)
|
| +{
|
| + Member<GeneratorHashSet>& set = m_pendingGenerators.add(name, nullptr).storedValue->value;
|
| + if (!set)
|
| + set = new GeneratorHashSet;
|
| + set->add(generator);
|
| +}
|
| +
|
| DEFINE_TRACE(PaintWorkletGlobalScope)
|
| {
|
| visitor->trace(m_paintDefinitions);
|
| + visitor->trace(m_pendingGenerators);
|
| WorkletGlobalScope::trace(visitor);
|
| }
|
|
|
|
|