OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef Worklet_h | |
6 #define Worklet_h | |
7 | |
8 #include "bindings/core/v8/ScriptPromise.h" | |
9 #include "bindings/core/v8/ScriptWrappable.h" | |
10 #include "core/dom/ActiveDOMObject.h" | |
11 #include "core/fetch/ScriptResource.h" | |
12 #include "modules/ModulesExport.h" | |
13 #include "platform/heap/Handle.h" | |
14 | |
15 namespace blink { | |
16 | |
17 class LocalFrame; | |
18 class ResourceFetcher; | |
19 class WorkletGlobalScopeProxy; | |
20 class WorkletScriptLoader; | |
21 | |
22 class MODULES_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>, public
ScriptWrappable, public ActiveDOMObject { | |
23 DEFINE_WRAPPERTYPEINFO(); | |
24 USING_GARBAGE_COLLECTED_MIXIN(Worklet); | |
25 WTF_MAKE_NONCOPYABLE(Worklet); | |
26 public: | |
27 virtual WorkletGlobalScopeProxy* workletGlobalScopeProxy() const = 0; | |
28 | |
29 // Worklet | |
30 ScriptPromise import(ScriptState*, const String& url); | |
31 | |
32 void notifyFinished(WorkletScriptLoader*); | |
33 | |
34 // ActiveDOMObject | |
35 void stop() final; | |
36 | |
37 DECLARE_VIRTUAL_TRACE(); | |
38 | |
39 protected: | |
40 // The Worklet inherits the url and userAgent from the frame->document(). | |
41 explicit Worklet(LocalFrame*); | |
42 | |
43 private: | |
44 ResourceFetcher* fetcher() const { return m_fetcher.get(); } | |
45 | |
46 Member<ResourceFetcher> m_fetcher; | |
47 HeapHashSet<Member<WorkletScriptLoader>> m_scriptLoaders; | |
48 }; | |
49 | |
50 } // namespace blink | |
51 | |
52 #endif // Worklet_h | |
OLD | NEW |