Chromium Code Reviews| 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 5690d8614bca1038ff4eda20b67055075d5858f1..4ddbeeb96795862c3b6918b706c5ad766e108e54 100644 |
| --- a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp |
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp |
| @@ -4,12 +4,12 @@ |
| #include "modules/csspaint/PaintWorkletGlobalScope.h" |
| -#include "bindings/core/v8/ScopedPersistent.h" |
| #include "bindings/core/v8/V8BindingMacros.h" |
| #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| #include "core/dom/ExceptionCode.h" |
| #include "core/inspector/MainThreadDebugger.h" |
| #include "modules/csspaint/CSSPaintDefinition.h" |
| +#include "modules/csspaint/CSSPaintImageGeneratorImpl.h" |
| namespace blink { |
| @@ -105,6 +105,17 @@ void PaintWorkletGlobalScope::registerPaint(const String& name, const ScriptValu |
| 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); |
|
haraken
2016/04/08 04:31:19
Member<GeneratorHashSet> => GeneratorHashSet*
ikilpatrick
2016/04/08 18:43:21
Done.
|
| + if (set) { |
| + for (const WeakMember<CSSPaintImageGeneratorImpl> generator : *set) { |
|
haraken
2016/04/08 04:31:19
WeakMember<CSSPaintImageGeneratorImpl> => auto&
ikilpatrick
2016/04/08 18:43:21
Done.
|
| + if (generator) { |
| + generator->setDefinition(definition); |
| + } |
| + } |
| + } |
| + m_pendingGenerators.remove(name); |
| } |
| CSSPaintDefinition* PaintWorkletGlobalScope::findDefinition(const String& name) |
| @@ -112,9 +123,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); |
| } |