| Index: third_party/WebKit/Source/modules/csspaint/PaintWorkletPendingGeneratorRegistry.cpp
|
| diff --git a/third_party/WebKit/Source/modules/csspaint/PaintWorkletPendingGeneratorRegistry.cpp b/third_party/WebKit/Source/modules/csspaint/PaintWorkletPendingGeneratorRegistry.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f8ae4b7957b423ebe2b3db7fccbadf1035b5819d
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/csspaint/PaintWorkletPendingGeneratorRegistry.cpp
|
| @@ -0,0 +1,38 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "modules/csspaint/PaintWorkletPendingGeneratorRegistry.h"
|
| +
|
| +#include "modules/csspaint/CSSPaintDefinition.h"
|
| +
|
| +namespace blink {
|
| +
|
| +void PaintWorkletPendingGeneratorRegistry::SetDefinition(
|
| + const String& name,
|
| + CSSPaintDefinition* definition) {
|
| + GeneratorHashSet* set = pending_generators_.at(name);
|
| + if (set) {
|
| + for (const auto& generator : *set) {
|
| + if (generator)
|
| + generator->SetDefinition(definition);
|
| + }
|
| + }
|
| + pending_generators_.erase(name);
|
| +}
|
| +
|
| +void PaintWorkletPendingGeneratorRegistry::AddPendingGenerator(
|
| + const String& name,
|
| + CSSPaintImageGeneratorImpl* generator) {
|
| + Member<GeneratorHashSet>& set =
|
| + pending_generators_.insert(name, nullptr).stored_value->value;
|
| + if (!set)
|
| + set = new GeneratorHashSet;
|
| + set->insert(generator);
|
| +}
|
| +
|
| +DEFINE_TRACE(PaintWorkletPendingGeneratorRegistry) {
|
| + visitor->Trace(pending_generators_);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|