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 ThreadedWorklet_h |
| 6 #define ThreadedWorklet_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 // A ThreadedWorklet is a worklet that runs off the main thread. |
| 20 // TODO(nhiroki): This is a temporary class to keep classic script loading for |
| 21 // threaded worklets while module loading is being implemented for main thread |
| 22 // worklets. This and MainThreadWorklet will be merged into the base Worklet |
| 23 // class once threaded worklets are also ready to use module loading. |
| 24 class CORE_EXPORT ThreadedWorklet : public Worklet, |
| 25 public WorkletScriptLoader::Client { |
| 26 USING_GARBAGE_COLLECTED_MIXIN(ThreadedWorklet); |
| 27 WTF_MAKE_NONCOPYABLE(ThreadedWorklet); |
| 28 |
| 29 public: |
| 30 virtual ~ThreadedWorklet() = default; |
| 31 |
| 32 // Worklet |
| 33 ScriptPromise import(ScriptState*, const String& url) final; |
| 34 |
| 35 // WorkletScriptLoader::Client |
| 36 void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*, |
| 37 const ScriptSourceCode&) final; |
| 38 |
| 39 // ContextLifecycleObserver |
| 40 void ContextDestroyed(ExecutionContext*) final; |
| 41 |
| 42 DECLARE_VIRTUAL_TRACE(); |
| 43 |
| 44 protected: |
| 45 explicit ThreadedWorklet(LocalFrame*); |
| 46 |
| 47 private: |
| 48 HeapHashMap<Member<WorkletScriptLoader>, Member<ScriptPromiseResolver>> |
| 49 loader_to_resolver_map_; |
| 50 }; |
| 51 |
| 52 } // namespace blink |
| 53 |
| 54 #endif // ThreadedWorklet_h |
OLD | NEW |