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 Worklet_h | 5 #ifndef Worklet_h |
6 #define Worklet_h | 6 #define Worklet_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 USING_GARBAGE_COLLECTED_MIXIN(Worklet); | 27 USING_GARBAGE_COLLECTED_MIXIN(Worklet); |
28 WTF_MAKE_NONCOPYABLE(Worklet); | 28 WTF_MAKE_NONCOPYABLE(Worklet); |
29 | 29 |
30 public: | 30 public: |
31 virtual ~Worklet() = default; | 31 virtual ~Worklet() = default; |
32 | 32 |
33 virtual void Initialize() {} | 33 virtual void Initialize() {} |
34 virtual bool IsInitialized() const { return true; } | 34 virtual bool IsInitialized() const { return true; } |
35 | 35 |
36 // Worklet.idl | 36 // Worklet.idl |
37 // import() imports ES6 module scripts. | 37 // addModule() imports ES6 module scripts. |
38 virtual ScriptPromise import(ScriptState*, const String& url) = 0; | 38 virtual ScriptPromise addModule(ScriptState*, const String& url) = 0; |
39 | 39 |
40 // Returns a proxy to WorkletGlobalScope on the context thread. | 40 // Returns a proxy to WorkletGlobalScope on the context thread. |
41 virtual WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const = 0; | 41 virtual WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const = 0; |
42 | 42 |
43 // ContextLifecycleObserver | 43 // ContextLifecycleObserver |
44 virtual void ContextDestroyed(ExecutionContext*); | 44 virtual void ContextDestroyed(ExecutionContext*); |
45 | 45 |
46 DECLARE_VIRTUAL_TRACE(); | 46 DECLARE_VIRTUAL_TRACE(); |
47 | 47 |
48 protected: | 48 protected: |
49 // The Worklet inherits the url and userAgent from the frame->document(). | 49 // The Worklet inherits the url and userAgent from the frame->document(). |
50 explicit Worklet(LocalFrame*); | 50 explicit Worklet(LocalFrame*); |
51 | 51 |
52 Member<LocalFrame> frame_; | 52 Member<LocalFrame> frame_; |
53 }; | 53 }; |
54 | 54 |
55 } // namespace blink | 55 } // namespace blink |
56 | 56 |
57 #endif // Worklet_h | 57 #endif // Worklet_h |
OLD | NEW |