| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PaintWorklet_h | 5 #ifndef PaintWorklet_h |
| 6 #define PaintWorklet_h | 6 #define PaintWorklet_h |
| 7 | 7 |
| 8 #include "core/workers/Worklet.h" | 8 #include "core/workers/Worklet.h" |
| 9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
| 10 #include "modules/csspaint/PaintWorkletGlobalScopeProxy.h" | 10 #include "modules/csspaint/PaintWorkletGlobalScopeProxy.h" |
| 11 #include "modules/csspaint/PaintWorkletPendingGeneratorRegistry.h" | 11 #include "modules/csspaint/PaintWorkletPendingGeneratorRegistry.h" |
| 12 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class CSSPaintDefinition; | 16 class CSSPaintDefinition; |
| 17 class CSSPaintImageGeneratorImpl; | 17 class CSSPaintImageGeneratorImpl; |
| 18 | 18 |
| 19 // Manages a paint worklet: | 19 // Manages a paint worklet: |
| 20 // https://drafts.css-houdini.org/css-paint-api/#dom-css-paintworklet | 20 // https://drafts.css-houdini.org/css-paint-api/#dom-css-paintworklet |
| 21 class MODULES_EXPORT PaintWorklet final : public Worklet { | 21 class MODULES_EXPORT PaintWorklet final : public Worklet, |
| 22 public Supplement<LocalDOMWindow> { |
| 23 USING_GARBAGE_COLLECTED_MIXIN(PaintWorklet); |
| 22 WTF_MAKE_NONCOPYABLE(PaintWorklet); | 24 WTF_MAKE_NONCOPYABLE(PaintWorklet); |
| 23 | 25 |
| 24 public: | 26 public: |
| 27 static PaintWorklet* From(LocalDOMWindow&); |
| 25 static PaintWorklet* Create(LocalFrame*); | 28 static PaintWorklet* Create(LocalFrame*); |
| 26 ~PaintWorklet() override; | 29 ~PaintWorklet() override; |
| 27 | 30 |
| 28 CSSPaintDefinition* FindDefinition(const String& name); | 31 CSSPaintDefinition* FindDefinition(const String& name); |
| 29 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*); | 32 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*); |
| 30 | 33 |
| 31 DECLARE_VIRTUAL_TRACE(); | 34 DECLARE_VIRTUAL_TRACE(); |
| 32 | 35 |
| 33 private: | 36 private: |
| 34 friend class PaintWorkletTest; | 37 friend class PaintWorkletTest; |
| 35 | 38 |
| 36 explicit PaintWorklet(LocalFrame*); | 39 explicit PaintWorklet(LocalFrame*); |
| 37 | 40 |
| 38 // Implements Worklet. | 41 // Implements Worklet. |
| 39 bool NeedsToCreateGlobalScope() final; | 42 bool NeedsToCreateGlobalScope() final; |
| 40 std::unique_ptr<WorkletGlobalScopeProxy> CreateGlobalScope() final; | 43 std::unique_ptr<WorkletGlobalScopeProxy> CreateGlobalScope() final; |
| 41 | 44 |
| 42 Member<PaintWorkletPendingGeneratorRegistry> pending_generator_registry_; | 45 Member<PaintWorkletPendingGeneratorRegistry> pending_generator_registry_; |
| 43 | 46 |
| 44 // TODO(style-dev): Implement the "document paint definition" concept: | 47 // TODO(style-dev): Implement the "document paint definition" concept: |
| 45 // https://drafts.css-houdini.org/css-paint-api/#document-paint-definition | 48 // https://drafts.css-houdini.org/css-paint-api/#document-paint-definition |
| 46 // (https://crbug.com/578252) | 49 // (https://crbug.com/578252) |
| 50 |
| 51 static const char* SupplementName(); |
| 47 }; | 52 }; |
| 48 | 53 |
| 49 } // namespace blink | 54 } // namespace blink |
| 50 | 55 |
| 51 #endif // PaintWorklet_h | 56 #endif // PaintWorklet_h |
| OLD | NEW |