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/PaintWorkletGlobalScopeProxy.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: | 18 // Manages a paint worklet: |
19 // https://drafts.css-houdini.org/css-paint-api/#dom-css-paintworklet | 19 // https://drafts.css-houdini.org/css-paint-api/#dom-css-paintworklet |
20 class MODULES_EXPORT PaintWorklet final : public MainThreadWorklet { | 20 class MODULES_EXPORT PaintWorklet final : public MainThreadWorklet { |
21 WTF_MAKE_NONCOPYABLE(PaintWorklet); | 21 WTF_MAKE_NONCOPYABLE(PaintWorklet); |
22 | 22 |
23 public: | 23 public: |
24 static PaintWorklet* Create(LocalFrame*); | 24 static PaintWorklet* Create(LocalFrame*); |
25 ~PaintWorklet() override; | 25 ~PaintWorklet() override; |
26 | 26 |
27 WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const final; | |
28 CSSPaintDefinition* FindDefinition(const String& name); | 27 CSSPaintDefinition* FindDefinition(const String& name); |
29 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*); | 28 void AddPendingGenerator(const String& name, CSSPaintImageGeneratorImpl*); |
30 | 29 |
31 DECLARE_VIRTUAL_TRACE(); | 30 DECLARE_VIRTUAL_TRACE(); |
32 | 31 |
33 private: | 32 private: |
| 33 friend class PaintWorkletTest; |
| 34 |
34 explicit PaintWorklet(LocalFrame*); | 35 explicit PaintWorklet(LocalFrame*); |
35 | 36 |
36 // TODO(nhiroki): Make (Paint)WorkletGlobalScopeProxy GC-managed object. | 37 // Implements MainThreadWorklet. |
37 std::unique_ptr<PaintWorkletGlobalScopeProxy> global_scope_proxy_; | 38 void AddWorkletGlobalScopesIfNeeded() final; |
38 }; | 39 }; |
39 | 40 |
40 } // namespace blink | 41 } // namespace blink |
41 | 42 |
42 #endif // PaintWorklet_h | 43 #endif // PaintWorklet_h |
OLD | NEW |