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/MainThreadWorklet.h" | 8 #include "core/workers/MainThreadWorklet.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 #include "modules/csspaint/PaintWorkletGlobalScope.h" | 10 #include "modules/csspaint/PaintWorkletGlobalScopeProxy.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class CSSPaintDefinition; | 15 class CSSPaintDefinition; |
16 class CSSPaintImageGeneratorImpl; | 16 class CSSPaintImageGeneratorImpl; |
17 | 17 |
| 18 // Manages a paint worklet: |
| 19 // https://drafts.css-houdini.org/css-paint-api/#dom-css-paintworklet |
18 class MODULES_EXPORT PaintWorklet final : public MainThreadWorklet { | 20 class MODULES_EXPORT PaintWorklet final : public MainThreadWorklet { |
19 WTF_MAKE_NONCOPYABLE(PaintWorklet); | 21 WTF_MAKE_NONCOPYABLE(PaintWorklet); |
20 | 22 |
21 public: | 23 public: |
22 static PaintWorklet* Create(LocalFrame*); | 24 static PaintWorklet* Create(LocalFrame*); |
23 ~PaintWorklet() override; | 25 ~PaintWorklet() override; |
24 | 26 |
25 PaintWorkletGlobalScope* GetWorkletGlobalScopeProxy() const final; | 27 WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const final; |
26 CSSPaintDefinition* FindDefinition(const String& name); | 28 CSSPaintDefinition* FindDefinition(const String& name); |
27 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*); | 29 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*); |
28 | 30 |
29 DECLARE_VIRTUAL_TRACE(); | 31 DECLARE_VIRTUAL_TRACE(); |
30 | 32 |
31 private: | 33 private: |
32 explicit PaintWorklet(LocalFrame*); | 34 explicit PaintWorklet(LocalFrame*); |
33 | 35 |
34 Member<PaintWorkletGlobalScope> paint_worklet_global_scope_; | 36 // TODO(nhiroki): Make (Paint)WorkletGlobalScopeProxy GC-managed object. |
| 37 std::unique_ptr<PaintWorkletGlobalScopeProxy> global_scope_proxy_; |
35 }; | 38 }; |
36 | 39 |
37 } // namespace blink | 40 } // namespace blink |
38 | 41 |
39 #endif // PaintWorklet_h | 42 #endif // PaintWorklet_h |
OLD | NEW |