OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 MainThreadWorklet_h | |
6 #define MainThreadWorklet_h | |
7 | |
8 #include "core/workers/Worklet.h" | |
9 | |
10 #include "bindings/core/v8/ScriptPromiseResolver.h" | |
11 #include "core/CoreExport.h" | |
12 #include "core/loader/WorkletScriptLoader.h" | |
13 #include "platform/heap/Handle.h" | |
14 | |
15 namespace blink { | |
16 | |
17 class LocalFrame; | |
18 | |
19 // TODO(nhiroki): This is a temporary class to support module loading for main | |
20 // thread worklets. This and ThreadedWorklet will be merged into the base | |
21 // Worklet class once threaded worklets are ready to use module loading. | |
falken
2017/04/17 05:35:54
In addition to the TODO, can you have a basic comm
nhiroki
2017/04/17 11:35:04
Done.
| |
22 class CORE_EXPORT MainThreadWorklet : public Worklet, | |
23 public WorkletScriptLoader::Client { | |
24 USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorklet); | |
25 WTF_MAKE_NONCOPYABLE(MainThreadWorklet); | |
26 | |
27 public: | |
28 virtual ~MainThreadWorklet() = default; | |
29 | |
30 // Worklet | |
31 ScriptPromise import(ScriptState*, const String& url) final; | |
32 | |
33 // WorkletScriptLoader::Client | |
34 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*, | |
35 const ScriptSourceCode&) final; | |
36 | |
37 // ContextLifecycleObserver | |
38 void ContextDestroyed(ExecutionContext*) final; | |
39 | |
40 DECLARE_VIRTUAL_TRACE(); | |
41 | |
42 protected: | |
43 explicit MainThreadWorklet(LocalFrame*); | |
44 | |
45 private: | |
46 HeapHashMap<Member<WorkletScriptLoader>, Member<ScriptPromiseResolver>> | |
47 loader_and_resolvers_; | |
falken
2017/04/17 05:35:54
nit: this name doesn't really sound like a map. |l
nhiroki
2017/04/17 11:35:04
Done.
| |
48 }; | |
49 | |
50 } // namespace blink | |
51 | |
52 #endif // MainThreadWorklet_h | |
OLD | NEW |