OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/csspaint/PaintWorkletPendingGeneratorRegistry.h" |
| 6 |
| 7 #include "modules/csspaint/CSSPaintDefinition.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 void PaintWorkletPendingGeneratorRegistry::SetDefinition( |
| 12 const String& name, |
| 13 CSSPaintDefinition* definition) { |
| 14 GeneratorHashSet* set = pending_generators_.at(name); |
| 15 if (set) { |
| 16 for (const auto& generator : *set) { |
| 17 if (generator) |
| 18 generator->SetDefinition(definition); |
| 19 } |
| 20 } |
| 21 pending_generators_.erase(name); |
| 22 } |
| 23 |
| 24 void PaintWorkletPendingGeneratorRegistry::AddPendingGenerator( |
| 25 const String& name, |
| 26 CSSPaintImageGeneratorImpl* generator) { |
| 27 Member<GeneratorHashSet>& set = |
| 28 pending_generators_.insert(name, nullptr).stored_value->value; |
| 29 if (!set) |
| 30 set = new GeneratorHashSet; |
| 31 set->insert(generator); |
| 32 } |
| 33 |
| 34 DEFINE_TRACE(PaintWorkletPendingGeneratorRegistry) { |
| 35 visitor->Trace(pending_generators_); |
| 36 } |
| 37 |
| 38 } // namespace blink |
OLD | NEW |