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 layout test failures Created 3 years, 7 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.
18 class PaintWorkletPendingGeneratorRegistry
19 : public GarbageCollected<PaintWorkletPendingGeneratorRegistry> {
20 WTF_MAKE_NONCOPYABLE(PaintWorkletPendingGeneratorRegistry);
21
22 public:
23 PaintWorkletPendingGeneratorRegistry() = default;
24
25 void SetDefinition(const String& name, CSSPaintDefinition*);
26 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*);
27
28 DECLARE_TRACE();
29
30 private:
31 // The map of CSSPaintImageGeneratorImpl which are waiting for a
32 // CSSPaintDefinition to be registered. Owners of this registry is expected to
33 // outlive the generators hence are held onto with a WeakMember.
34 using GeneratorHashSet = HeapHashSet<WeakMember<CSSPaintImageGeneratorImpl>>;
35 using PendingGeneratorMap = HeapHashMap<String, Member<GeneratorHashSet>>;
36 PendingGeneratorMap pending_generators_;
37 };
38
39 } // namespace blink
40
41 #endif // PaintWorkletPendingGeneratorRegistry_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698