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

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

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.cpp
diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletGlobalScope.cpp
index 5690d8614bca1038ff4eda20b67055075d5858f1..d109ce44b898fe112fc6a20069194f3d500ff0b4 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.
+ GeneratorHashSet* set = m_pendingGenerators.get(name);
+ if (set) {
+ for (const auto& generator : *set) {
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698