Chromium Code Reviews| Index: third_party/WebKit/Source/core/workers/ThreadedWorklet.h |
| diff --git a/third_party/WebKit/Source/core/workers/ThreadedWorklet.h b/third_party/WebKit/Source/core/workers/ThreadedWorklet.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ff216153ede27a04d9ea00ab54b332773be72c6d |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/workers/ThreadedWorklet.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ThreadedWorklet_h |
| +#define ThreadedWorklet_h |
| + |
| +#include "core/workers/Worklet.h" |
| + |
| +#include "bindings/core/v8/ScriptPromiseResolver.h" |
| +#include "core/CoreExport.h" |
| +#include "core/loader/WorkletScriptLoader.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class LocalFrame; |
| + |
| +// TODO(nhiroki): This is a temporary class to keep classic script loading for |
| +// threaded worklets while module loading is being implemented for main thread |
| +// worklets. This and MainThreadWorklet will be merged into the base Worklet |
| +// 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.
|
| +class CORE_EXPORT ThreadedWorklet : public Worklet, |
| + public WorkletScriptLoader::Client { |
| + USING_GARBAGE_COLLECTED_MIXIN(ThreadedWorklet); |
| + WTF_MAKE_NONCOPYABLE(ThreadedWorklet); |
| + |
| + public: |
| + virtual ~ThreadedWorklet() = default; |
| + |
| + // Worklet |
| + ScriptPromise import(ScriptState*, const String& url) final; |
| + |
| + // WorkletScriptLoader::Client |
| + void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*, |
| + const ScriptSourceCode&) final; |
| + |
| + // ContextLifecycleObserver |
| + void ContextDestroyed(ExecutionContext*) final; |
| + |
| + DECLARE_VIRTUAL_TRACE(); |
| + |
| + protected: |
| + explicit ThreadedWorklet(LocalFrame*); |
| + |
| + private: |
| + HeapHashMap<Member<WorkletScriptLoader>, Member<ScriptPromiseResolver>> |
| + loader_and_resolvers_; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // ThreadedWorklet_h |