Index: third_party/WebKit/Source/core/workers/ThreadedWorklet.cpp |
diff --git a/third_party/WebKit/Source/core/workers/Worklet.cpp b/third_party/WebKit/Source/core/workers/ThreadedWorklet.cpp |
similarity index 77% |
copy from third_party/WebKit/Source/core/workers/Worklet.cpp |
copy to third_party/WebKit/Source/core/workers/ThreadedWorklet.cpp |
index a5f9e2a9956dbb53af533920a85f9558f047f120..23b41f9990f6736b5ee13f7ece2683fad51b0ec2 100644 |
--- a/third_party/WebKit/Source/core/workers/Worklet.cpp |
+++ b/third_party/WebKit/Source/core/workers/ThreadedWorklet.cpp |
@@ -1,8 +1,8 @@ |
-// Copyright 2016 The Chromium Authors. All rights reserved. |
+// 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. |
-#include "core/workers/Worklet.h" |
+#include "core/workers/ThreadedWorklet.h" |
#include "bindings/core/v8/ScriptSourceCode.h" |
#include "bindings/core/v8/V8Binding.h" |
@@ -15,10 +15,10 @@ |
namespace blink { |
-Worklet::Worklet(LocalFrame* frame) |
- : ContextLifecycleObserver(frame->GetDocument()), frame_(frame) {} |
+ThreadedWorklet::ThreadedWorklet(LocalFrame* frame) |
+ : Worklet(frame) {} |
-ScriptPromise Worklet::import(ScriptState* script_state, const String& url) { |
+ScriptPromise ThreadedWorklet::import(ScriptState* script_state, const String& url) { |
DCHECK(IsMainThread()); |
if (!GetExecutionContext()) { |
return ScriptPromise::RejectWithDOMException( |
@@ -46,7 +46,7 @@ ScriptPromise Worklet::import(ScriptState* script_state, const String& url) { |
return promise; |
} |
-void Worklet::NotifyWorkletScriptLoadingFinished( |
+void ThreadedWorklet::NotifyWorkletScriptLoadingFinished( |
WorkletScriptLoader* script_loader, |
const ScriptSourceCode& source_code) { |
DCHECK(IsMainThread()); |
@@ -62,20 +62,17 @@ void Worklet::NotifyWorkletScriptLoadingFinished( |
resolver->Resolve(); |
} |
-void Worklet::ContextDestroyed(ExecutionContext*) { |
+void ThreadedWorklet::ContextDestroyed(ExecutionContext* execution_context) { |
DCHECK(IsMainThread()); |
- if (IsInitialized()) |
- GetWorkletGlobalScopeProxy()->TerminateWorkletGlobalScope(); |
for (const auto& script_loader : loader_and_resolvers_.Keys()) |
script_loader->Cancel(); |
loader_and_resolvers_.Clear(); |
- frame_ = nullptr; |
+ Worklet::ContextDestroyed(execution_context); |
} |
-DEFINE_TRACE(Worklet) { |
- visitor->Trace(frame_); |
+DEFINE_TRACE(ThreadedWorklet) { |
visitor->Trace(loader_and_resolvers_); |
- ContextLifecycleObserver::Trace(visitor); |
+ Worklet::Trace(visitor); |
} |
} // namespace blink |