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/dom/ActiveDOMObject.h" | 10 #include "core/dom/ActiveDOMObject.h" |
11 #include "core/frame/csp/ContentSecurityPolicy.h" | 11 #include "core/frame/csp/ContentSecurityPolicy.h" |
12 #include "core/workers/WorkerScriptLoader.h" | 12 #include "core/workers/WorkerScriptLoader.h" |
13 #include "modules/worklet/WorkletGlobalScope.h" | 13 #include "modules/worklet/WorkletGlobalScope.h" |
14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 class ExecutionContext; | 18 class ExecutionContext; |
19 class ScriptPromiseResolver; | 19 class ScriptPromiseResolver; |
20 class WorkerScriptLoader; | 20 class WorkerScriptLoader; |
21 | 21 |
22 class Worklet final : public GarbageCollectedFinalized<Worklet>, public ScriptWr appable, public ActiveDOMObject { | 22 class Worklet : public GarbageCollectedFinalized<Worklet>, public ScriptWrappabl e, public ActiveDOMObject { |
23 DEFINE_WRAPPERTYPEINFO(); | 23 DEFINE_WRAPPERTYPEINFO(); |
24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Worklet); | 24 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Worklet); |
25 WTF_MAKE_NONCOPYABLE(Worklet); | 25 WTF_MAKE_NONCOPYABLE(Worklet); |
26 public: | 26 public: |
27 // The ExecutionContext argument is the parent document of the Worklet. The | 27 virtual WorkletGlobalScope* workletGlobalScope() const = 0; |
28 // Worklet inherits the url and userAgent, from the document. | |
29 static Worklet* create(LocalFrame*, ExecutionContext*); | |
30 | 28 |
29 // Worklet | |
31 ScriptPromise import(ScriptState*, const String& url); | 30 ScriptPromise import(ScriptState*, const String& url); |
32 | 31 |
33 // ActiveDOMObject | 32 // ActiveDOMObject |
34 void stop() final; | 33 void stop() final; |
35 | 34 |
36 DECLARE_TRACE(); | 35 DECLARE_VIRTUAL_TRACE(); |
36 | |
37 protected: | |
38 // The ExecutionContext argument is the parent document of the Worklet. The | |
39 // Worklet inherits the url and userAgent, from the document. | |
haraken
2016/03/22 01:52:56
Unnecessary ','.
ikilpatrick
2016/03/22 20:31:51
Done.
| |
40 explicit Worklet(ExecutionContext*); | |
37 | 41 |
38 private: | 42 private: |
39 Worklet(LocalFrame*, ExecutionContext*); | |
40 | |
41 void onResponse(); | 43 void onResponse(); |
42 void onFinished(WorkerScriptLoader*, ScriptPromiseResolver*); | 44 void onFinished(WorkerScriptLoader*, ScriptPromiseResolver*); |
43 | 45 |
44 RefPtrWillBeMember<WorkletGlobalScope> m_workletGlobalScope; | |
45 Vector<RefPtr<WorkerScriptLoader>> m_scriptLoaders; | 46 Vector<RefPtr<WorkerScriptLoader>> m_scriptLoaders; |
46 HeapVector<Member<ScriptPromiseResolver>> m_resolvers; | 47 HeapVector<Member<ScriptPromiseResolver>> m_resolvers; |
47 }; | 48 }; |
48 | 49 |
49 } // namespace blink | 50 } // namespace blink |
50 | 51 |
51 #endif // Worklet_h | 52 #endif // Worklet_h |
OLD | NEW |