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/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/dom/ActiveDOMObject.h" | |
11 #include "core/frame/csp/ContentSecurityPolicy.h" | |
12 #include "core/workers/WorkerScriptLoader.h" | |
9 #include "modules/worklet/WorkletGlobalScope.h" | 13 #include "modules/worklet/WorkletGlobalScope.h" |
10 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
11 | 15 |
12 namespace blink { | 16 namespace blink { |
13 | 17 |
14 class ExecutionContext; | 18 class ExecutionContext; |
19 class ScriptPromiseResolver; | |
20 class WorkerScriptLoader; | |
15 | 21 |
16 class Worklet final : public GarbageCollectedFinalized<Worklet>, public ScriptWr appable { | 22 class Worklet final : public GarbageCollectedFinalized<Worklet>, public ScriptWr appable, public ActiveDOMObject { |
23 DEFINE_WRAPPERTYPEINFO(); | |
24 USING_GARBAGE_COLLECTED_MIXIN(Worklet); | |
17 WTF_MAKE_NONCOPYABLE(Worklet); | 25 WTF_MAKE_NONCOPYABLE(Worklet); |
18 DEFINE_WRAPPERTYPEINFO(); | |
19 public: | 26 public: |
20 // The ExecutionContext argument is the parent document of the Worklet. The | 27 // The ExecutionContext argument is the parent document of the Worklet. The |
21 // Worklet inherits the url and userAgent, from the document. | 28 // Worklet inherits the url and userAgent, from the document. |
22 static Worklet* create(ExecutionContext*); | 29 static Worklet* create(ExecutionContext*); |
23 | 30 |
31 ScriptPromise import(ScriptState*, const String& url); | |
32 | |
33 // ActiveDOMObject | |
34 void stop() final; | |
35 bool hasPendingActivity() const final; | |
kinuko
2016/02/12 07:25:45
nit: this method is now moved to ScriptWrappable a
ikilpatrick
2016/02/12 22:59:57
I'm unsure as well. I had a hunch that this wasn't
kinuko
2016/02/15 04:58:27
I _think_ we should be fine without implementing h
ikilpatrick
2016/02/16 19:34:14
Makes sense, removed hasPendingActivity.
I can th
| |
36 | |
24 DECLARE_TRACE(); | 37 DECLARE_TRACE(); |
25 | 38 |
26 private: | 39 private: |
27 explicit Worklet(ExecutionContext*); | 40 explicit Worklet(ExecutionContext*); |
28 | 41 |
42 void onResponse(); | |
43 void onFinished(WorkerScriptLoader*, ScriptPromiseResolver*); | |
44 | |
29 RefPtrWillBeMember<WorkletGlobalScope> m_workletGlobalScope; | 45 RefPtrWillBeMember<WorkletGlobalScope> m_workletGlobalScope; |
46 Vector<RefPtr<WorkerScriptLoader>> m_scriptLoaders; | |
47 HeapVector<Member<ScriptPromiseResolver>> m_resolvers; | |
30 }; | 48 }; |
31 | 49 |
32 } // namespace blink | 50 } // namespace blink |
33 | 51 |
34 #endif // Worklet_h | 52 #endif // Worklet_h |
OLD | NEW |