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

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

Issue 2871503003: Worklet: Move common code from Worker/WorkletGlobalScope to WorkerOrWorkletGlobalScope (Closed)
Patch Set: fix rebase failure Created 3 years, 7 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/WorkerOrWorkletGlobalScope.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
index 8743d587960f8145e9fd6db7cd6e97f53abcee2f..108d35c1f638dbb838af1caa6cc3ebf01829b660 100644
--- a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
@@ -4,6 +4,7 @@
#include "core/workers/WorkerOrWorkletGlobalScope.h"
+#include "bindings/core/v8/WorkerOrWorkletScriptController.h"
#include "core/dom/ExecutionContextTask.h"
#include "core/dom/TaskRunnerHelper.h"
#include "core/frame/Deprecation.h"
@@ -16,8 +17,10 @@
namespace blink {
-WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope()
- : used_features_(UseCounter::kNumberOfFeatures) {}
+WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope(v8::Isolate* isolate)
+ : script_controller_(
+ WorkerOrWorkletScriptController::Create(this, isolate)),
+ used_features_(UseCounter::kNumberOfFeatures) {}
WorkerOrWorkletGlobalScope::~WorkerOrWorkletGlobalScope() = default;
@@ -46,6 +49,14 @@ void WorkerOrWorkletGlobalScope::CountDeprecation(UseCounter::Feature feature) {
ReportDeprecation(feature);
}
+bool WorkerOrWorkletGlobalScope::IsJSExecutionForbidden() const {
+ return script_controller_->IsExecutionForbidden();
+}
+
+void WorkerOrWorkletGlobalScope::DisableEval(const String& error_message) {
+ script_controller_->DisableEval(error_message);
+}
+
void WorkerOrWorkletGlobalScope::PostTask(
TaskType type,
const WebTraceLocation& location,
@@ -66,6 +77,17 @@ void WorkerOrWorkletGlobalScope::PostTask(
is_instrumented));
}
+void WorkerOrWorkletGlobalScope::Dispose() {
+ DCHECK(script_controller_);
+ script_controller_->Dispose();
+ script_controller_.Clear();
+}
+
+DEFINE_TRACE(WorkerOrWorkletGlobalScope) {
+ visitor->Trace(script_controller_);
+ ExecutionContext::Trace(visitor);
+}
+
void WorkerOrWorkletGlobalScope::RunTask(
std::unique_ptr<ExecutionContextTask> task,
bool is_instrumented) {

Powered by Google App Engine
This is Rietveld 408576698