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

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

Issue 2819153003: Worklet: Separate Worklet into MainThreadWorklet and ThreadedWorklet (Closed)
Patch Set: 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.cpp
diff --git a/third_party/WebKit/Source/core/workers/Worklet.cpp b/third_party/WebKit/Source/core/workers/MainThreadWorklet.cpp
similarity index 77%
copy from third_party/WebKit/Source/core/workers/Worklet.cpp
copy to third_party/WebKit/Source/core/workers/MainThreadWorklet.cpp
index a5f9e2a9956dbb53af533920a85f9558f047f120..3ee1cc9e05a487049e03b4156b5280ef888bcc90 100644
--- a/third_party/WebKit/Source/core/workers/Worklet.cpp
+++ b/third_party/WebKit/Source/core/workers/MainThreadWorklet.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/MainThreadWorklet.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) {}
+MainThreadWorklet::MainThreadWorklet(LocalFrame* frame)
+ : Worklet(frame) {}
-ScriptPromise Worklet::import(ScriptState* script_state, const String& url) {
+ScriptPromise MainThreadWorklet::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 MainThreadWorklet::NotifyWorkletScriptLoadingFinished(
WorkletScriptLoader* script_loader,
const ScriptSourceCode& source_code) {
DCHECK(IsMainThread());
@@ -62,20 +62,17 @@ void Worklet::NotifyWorkletScriptLoadingFinished(
resolver->Resolve();
}
-void Worklet::ContextDestroyed(ExecutionContext*) {
+void MainThreadWorklet::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(MainThreadWorklet) {
visitor->Trace(loader_and_resolvers_);
- ContextLifecycleObserver::Trace(visitor);
+ Worklet::Trace(visitor);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698