Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(776)

Unified Diff: third_party/WebKit/Source/core/workers/Worklet.h

Issue 2819153003: Worklet: Separate Worklet into MainThreadWorklet and ThreadedWorklet (Closed)
Patch Set: update comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/workers/Worklet.h
diff --git a/third_party/WebKit/Source/core/workers/Worklet.h b/third_party/WebKit/Source/core/workers/Worklet.h
index 6d44e30f35ec4ee13538fe7897b701f07799c1ad..f482229f2e93cd6f16668eaece83181980d592a2 100644
--- a/third_party/WebKit/Source/core/workers/Worklet.h
+++ b/third_party/WebKit/Source/core/workers/Worklet.h
@@ -6,21 +6,21 @@
#define Worklet_h
#include "bindings/core/v8/ScriptPromise.h"
-#include "bindings/core/v8/ScriptPromiseResolver.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h"
#include "core/dom/ContextLifecycleObserver.h"
-#include "core/loader/WorkletScriptLoader.h"
#include "platform/heap/Handle.h"
-#include "platform/loader/fetch/ResourceFetcher.h"
namespace blink {
class LocalFrame;
class WorkletGlobalScopeProxy;
+// This is the base implementation of Worklet interface defined in the spec:
+// https://drafts.css-houdini.org/worklets/#worklet
+// Although some worklets run off the main thread, this must be created and
+// destroyed on the main thread.
class CORE_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>,
- public WorkletScriptLoader::Client,
public ScriptWrappable,
public ContextLifecycleObserver {
DEFINE_WRAPPERTYPEINFO();
@@ -33,17 +33,15 @@ class CORE_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>,
virtual void Initialize() {}
virtual bool IsInitialized() const { return true; }
- virtual WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const = 0;
-
- // Worklet
- ScriptPromise import(ScriptState*, const String& url);
+ // Worklet.idl
+ // import() imports ES6 module scripts.
+ virtual ScriptPromise import(ScriptState*, const String& url) = 0;
- // WorkletScriptLoader::Client
- void NotifyWorkletScriptLoadingFinished(WorkletScriptLoader*,
- const ScriptSourceCode&) final;
+ // Returns a proxy to WorkletGlobalScope on the context thread.
+ virtual WorkletGlobalScopeProxy* GetWorkletGlobalScopeProxy() const = 0;
// ContextLifecycleObserver
- void ContextDestroyed(ExecutionContext*) final;
+ virtual void ContextDestroyed(ExecutionContext*);
DECLARE_VIRTUAL_TRACE();
@@ -51,10 +49,7 @@ class CORE_EXPORT Worklet : public GarbageCollectedFinalized<Worklet>,
// The Worklet inherits the url and userAgent from the frame->document().
explicit Worklet(LocalFrame*);
- private:
Member<LocalFrame> frame_;
- HeapHashMap<Member<WorkletScriptLoader>, Member<ScriptPromiseResolver>>
- loader_and_resolvers_;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/workers/ThreadedWorklet.cpp ('k') | third_party/WebKit/Source/core/workers/Worklet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698