| Index: third_party/WebKit/Source/modules/csspaint/PaintWorklet.cpp
|
| diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorklet.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorklet.cpp
|
| index bef58fcd3961ed1343b2c1688bb99a3ec19f3298..68e84f233a3f679d40c58bb7337d2755e2d41b45 100644
|
| --- a/third_party/WebKit/Source/modules/csspaint/PaintWorklet.cpp
|
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorklet.cpp
|
| @@ -6,11 +6,23 @@
|
|
|
| #include "bindings/core/v8/V8BindingForCore.h"
|
| #include "core/dom/Document.h"
|
| +#include "core/frame/LocalDOMWindow.h"
|
| #include "core/frame/LocalFrame.h"
|
| #include "modules/csspaint/PaintWorkletGlobalScope.h"
|
|
|
| namespace blink {
|
|
|
| +// static
|
| +PaintWorklet* PaintWorklet::From(LocalDOMWindow& window) {
|
| + PaintWorklet* supplement = static_cast<PaintWorklet*>(
|
| + Supplement<LocalDOMWindow>::From(window, SupplementName()));
|
| + if (!supplement && window.GetFrame()) {
|
| + supplement = Create(window.GetFrame());
|
| + ProvideTo(window, SupplementName(), supplement);
|
| + }
|
| + return supplement;
|
| +}
|
| +
|
| // static
|
| PaintWorklet* PaintWorklet::Create(LocalFrame* frame) {
|
| return new PaintWorklet(frame);
|
| @@ -18,6 +30,7 @@ PaintWorklet* PaintWorklet::Create(LocalFrame* frame) {
|
|
|
| PaintWorklet::PaintWorklet(LocalFrame* frame)
|
| : Worklet(frame),
|
| + Supplement<LocalDOMWindow>(*frame->DomWindow()),
|
| pending_generator_registry_(new PaintWorkletPendingGeneratorRegistry) {}
|
|
|
| PaintWorklet::~PaintWorklet() = default;
|
| @@ -36,9 +49,14 @@ void PaintWorklet::AddPendingGenerator(const String& name,
|
| pending_generator_registry_->AddPendingGenerator(name, generator);
|
| }
|
|
|
| +const char* PaintWorklet::SupplementName() {
|
| + return "PaintWorklet";
|
| +}
|
| +
|
| DEFINE_TRACE(PaintWorklet) {
|
| visitor->Trace(pending_generator_registry_);
|
| Worklet::Trace(visitor);
|
| + Supplement<LocalDOMWindow>::Trace(visitor);
|
| }
|
|
|
| bool PaintWorklet::NeedsToCreateGlobalScope() {
|
|
|