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

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

Issue 2312493002: [worklets] Introduce ThreadedWorkletMessagingProxy and AnimationWorkletMessagaingProxy. (Closed)
Patch Set: rebase. Created 4 years, 3 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.cpp
diff --git a/third_party/WebKit/Source/core/workers/Worklet.cpp b/third_party/WebKit/Source/core/workers/Worklet.cpp
index e3b01ca0e6149b82b2c5c71bd16a0d207adb7027..45578adc1b09e7933366db9c221b5406d52f6c0d 100644
--- a/third_party/WebKit/Source/core/workers/Worklet.cpp
+++ b/third_party/WebKit/Source/core/workers/Worklet.cpp
@@ -27,6 +27,10 @@ Worklet::Worklet(LocalFrame* frame)
ScriptPromise Worklet::import(ScriptState* scriptState, const String& url)
{
+ if (!isInitialized()) {
+ initialize();
+ }
+
KURL scriptURL = getExecutionContext()->completeURL(url);
if (!scriptURL.isValid()) {
return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(SyntaxError, "'" + url + "' is not a valid URL."));
@@ -56,7 +60,10 @@ void Worklet::notifyFinished(WorkletScriptLoader* scriptLoader)
void Worklet::stop()
{
- workletGlobalScopeProxy()->terminateWorkletGlobalScope();
+ if (isInitialized()) {
+ workletGlobalScopeProxy()->terminateWorkletGlobalScope();
+ }
+
for (const auto& scriptLoader : m_scriptLoaders) {
scriptLoader->cancel();
}

Powered by Google App Engine
This is Rietveld 408576698