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