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 |
index e6b5c8578b3986d939aa7b2c42146a6d8ced3aa9..af595fb974f31c490a7b051379ed2efacce9d4c8 100644 |
--- a/third_party/WebKit/Source/core/workers/MainThreadWorklet.h |
+++ b/third_party/WebKit/Source/core/workers/MainThreadWorklet.h |
@@ -15,6 +15,7 @@ namespace blink { |
class LocalFrame; |
class ScriptPromiseResolver; |
+class WorkletGlobalScopeProxy; |
// 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 |
@@ -38,9 +39,27 @@ class CORE_EXPORT MainThreadWorklet : public Worklet { |
protected: |
explicit MainThreadWorklet(LocalFrame*); |
+ WTF::HashSet<std::unique_ptr<WorkletGlobalScopeProxy>>& GetProxies() { |
+ return global_scope_proxies_; |
+ } |
+ |
private: |
+ // Returns true if there are no global scopes or additional global scopes are |
+ // necessary. CreateGlobalScope() will be called in that case. Each worklet |
+ // can define how to pool global scopes here. |
+ virtual bool NeedsToCreateGlobalScope() = 0; |
+ virtual std::unique_ptr<WorkletGlobalScopeProxy> CreateGlobalScope() = 0; |
+ |
void FetchAndInvokeScript(const KURL& module_url_record, |
ScriptPromiseResolver*); |
+ |
+ // "A Worklet has a list of the worklet's WorkletGlobalScopes. Initially this |
+ // list is empty; it is populated when the user agent chooses to create its |
+ // WorkletGlobalScope." |
+ // https://drafts.css-houdini.org/worklets/#worklet-section |
+ // TODO(nhiroki): Make (Paint)WorkletGlobalScopeProxy GC-managed object to |
+ // avoid that GC graphs are disjointed (https://crbug.com/719775). |
+ WTF::HashSet<std::unique_ptr<WorkletGlobalScopeProxy>> global_scope_proxies_; |
}; |
} // namespace blink |