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

Side by Side Diff: third_party/WebKit/Source/modules/csspaint/PaintWorkletPendingGeneratorRegistry.cpp

Issue 2871513002: Worklet: Lazily create PaintWorkletGlobalScopes (Closed)
Patch Set: fix wrong dcheck Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698