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 #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 |
OLD | NEW |