OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/csspaint/PaintWorkletGlobalScope.h" | 5 #include "modules/csspaint/PaintWorkletGlobalScope.h" |
6 | 6 |
7 #include "bindings/core/v8/V8BindingMacros.h" | 7 #include "bindings/core/v8/V8BindingMacros.h" |
8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 8 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
9 #include "core/CSSPropertyNames.h" | 9 #include "core/CSSPropertyNames.h" |
10 #include "core/css/CSSSyntaxDescriptor.h" | 10 #include "core/css/CSSSyntaxDescriptor.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 // Set the definition on any pending generators. | 191 // Set the definition on any pending generators. |
192 GeneratorHashSet* set = m_pendingGenerators.get(name); | 192 GeneratorHashSet* set = m_pendingGenerators.get(name); |
193 if (set) { | 193 if (set) { |
194 for (const auto& generator : *set) { | 194 for (const auto& generator : *set) { |
195 if (generator) { | 195 if (generator) { |
196 generator->setDefinition(definition); | 196 generator->setDefinition(definition); |
197 } | 197 } |
198 } | 198 } |
199 } | 199 } |
200 m_pendingGenerators.remove(name); | 200 m_pendingGenerators.erase(name); |
201 } | 201 } |
202 | 202 |
203 CSSPaintDefinition* PaintWorkletGlobalScope::findDefinition( | 203 CSSPaintDefinition* PaintWorkletGlobalScope::findDefinition( |
204 const String& name) { | 204 const String& name) { |
205 return m_paintDefinitions.get(name); | 205 return m_paintDefinitions.get(name); |
206 } | 206 } |
207 | 207 |
208 void PaintWorkletGlobalScope::addPendingGenerator( | 208 void PaintWorkletGlobalScope::addPendingGenerator( |
209 const String& name, | 209 const String& name, |
210 CSSPaintImageGeneratorImpl* generator) { | 210 CSSPaintImageGeneratorImpl* generator) { |
211 Member<GeneratorHashSet>& set = | 211 Member<GeneratorHashSet>& set = |
212 m_pendingGenerators.add(name, nullptr).storedValue->value; | 212 m_pendingGenerators.add(name, nullptr).storedValue->value; |
213 if (!set) | 213 if (!set) |
214 set = new GeneratorHashSet; | 214 set = new GeneratorHashSet; |
215 set->insert(generator); | 215 set->insert(generator); |
216 } | 216 } |
217 | 217 |
218 DEFINE_TRACE(PaintWorkletGlobalScope) { | 218 DEFINE_TRACE(PaintWorkletGlobalScope) { |
219 visitor->trace(m_paintDefinitions); | 219 visitor->trace(m_paintDefinitions); |
220 visitor->trace(m_pendingGenerators); | 220 visitor->trace(m_pendingGenerators); |
221 MainThreadWorkletGlobalScope::trace(visitor); | 221 MainThreadWorkletGlobalScope::trace(visitor); |
222 } | 222 } |
223 | 223 |
224 } // namespace blink | 224 } // namespace blink |
OLD | NEW |