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

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

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 #ifndef PaintWorkletPendingGeneratorRegistry_h
6 #define PaintWorkletPendingGeneratorRegistry_h
7
8 #include "modules/csspaint/CSSPaintImageGeneratorImpl.h"
9 #include "platform/heap/Heap.h"
10 #include "platform/heap/HeapAllocator.h"
11
12 namespace blink {
13
14 class CSSPaintDefinition;
15
16 // Keeps pending CSSPaintImageGeneratorImpls until corresponding
17 // CSSPaintDefinitions are registered. This is primarily owned by the
18 // PaintWorklet instance.
19 class PaintWorkletPendingGeneratorRegistry
20 : public GarbageCollected<PaintWorkletPendingGeneratorRegistry> {
21 WTF_MAKE_NONCOPYABLE(PaintWorkletPendingGeneratorRegistry);
22
23 public:
24 PaintWorkletPendingGeneratorRegistry() = default;
25
26 void SetDefinition(const String& name, CSSPaintDefinition*);
27 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*);
28
29 DECLARE_TRACE();
30
31 private:
32 // The map of CSSPaintImageGeneratorImpl which are waiting for a
33 // CSSPaintDefinition to be registered. Owners of this registry is expected to
34 // outlive the generators hence are held onto with a WeakMember.
35 using GeneratorHashSet = HeapHashSet<WeakMember<CSSPaintImageGeneratorImpl>>;
36 using PendingGeneratorMap = HeapHashMap<String, Member<GeneratorHashSet>>;
37 PendingGeneratorMap pending_generators_;
38 };
39
40 } // namespace blink
41
42 #endif // PaintWorkletPendingGeneratorRegistry_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698