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