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

Unified Diff: third_party/WebKit/Source/core/workers/MainThreadWorklet.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/MainThreadWorklet.h
diff --git a/third_party/WebKit/Source/core/workers/MainThreadWorklet.h b/third_party/WebKit/Source/core/workers/MainThreadWorklet.h
new file mode 100644
index 0000000000000000000000000000000000000000..858d1e9a7c3b71b08f5770ed1c5bf72e124a3887
--- /dev/null
+++ b/third_party/WebKit/Source/core/workers/MainThreadWorklet.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 MainThreadWorklet_h
+#define MainThreadWorklet_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;
+
+// A MainThreadWorklet is a worklet that runs only on the main thread.
+// TODO(nhiroki): This is a temporary class to support module loading for main
+// thread worklets. This and ThreadedWorklet will be merged into the base
+// Worklet class once threaded worklets are ready to use module loading.
+class CORE_EXPORT MainThreadWorklet : public Worklet,
+ public WorkletScriptLoader::Client {
+ USING_GARBAGE_COLLECTED_MIXIN(MainThreadWorklet);
+ WTF_MAKE_NONCOPYABLE(MainThreadWorklet);
+
+ public:
+ virtual ~MainThreadWorklet() = 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 MainThreadWorklet(LocalFrame*);
+
+ private:
+ HeapHashMap<Member<WorkletScriptLoader>, Member<ScriptPromiseResolver>>
+ loader_to_resolver_map_;
+};
+
+} // namespace blink
+
+#endif // MainThreadWorklet_h
« no previous file with comments | « third_party/WebKit/Source/core/workers/BUILD.gn ('k') | third_party/WebKit/Source/core/workers/MainThreadWorklet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698