chromium/third_party/blink/renderer/core/frame/pausable_script_executor.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "third_party/blink/renderer/core/frame/pausable_script_executor.h"

#include <memory>
#include <utility>

#include "base/check.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "third_party/blink/public/mojom/frame/user_activation_notification_type.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/web/web_script_execution_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h"
#include "third_party/blink/renderer/bindings/core/v8/script_function.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/window_proxy.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/script/classic_script.h"
#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"

namespace blink {

namespace {

// A helper class that aggregates the result of multiple values, including
// waiting for the results if those values are promises (or otherwise
// then-able).
class PromiseAggregator : public GarbageCollected<PromiseAggregator> {};

PromiseAggregator::PromiseAggregator(ScriptState* script_state,
                                     const v8::LocalVector<v8::Value>& values,
                                     Callback callback)
    :{}

void PromiseAggregator::OnAllSettled(v8::Isolate* isolate) {}

class WebScriptExecutor : public PausableScriptExecutor::Executor {};

class V8FunctionExecutor : public PausableScriptExecutor::Executor {};

V8FunctionExecutor::V8FunctionExecutor(v8::Isolate* isolate,
                                       v8::Local<v8::Function> function,
                                       v8::Local<v8::Value> receiver,
                                       int argc,
                                       v8::Local<v8::Value> argv[])
    :{}

v8::LocalVector<v8::Value> V8FunctionExecutor::Execute(
    ScriptState* script_state) {}

void V8FunctionExecutor::Trace(Visitor* visitor) const {}

}  // namespace

void PausableScriptExecutor::CreateAndRun(
    v8::Local<v8::Context> context,
    v8::Local<v8::Function> function,
    v8::Local<v8::Value> receiver,
    int argc,
    v8::Local<v8::Value> argv[],
    mojom::blink::WantResultOption want_result_option,
    WebScriptExecutionCallback callback) {}

void PausableScriptExecutor::CreateAndRun(
    ScriptState* script_state,
    Vector<WebScriptSource> sources,
    ExecuteScriptPolicy execute_script_policy,
    mojom::blink::UserActivationOption user_activation_option,
    mojom::blink::EvaluationTiming evaluation_timing,
    mojom::blink::LoadEventBlockingOption blocking_option,
    mojom::blink::WantResultOption want_result_option,
    mojom::blink::PromiseResultOption promise_result_option,
    WebScriptExecutionCallback callback) {}

void PausableScriptExecutor::ContextDestroyed() {}

PausableScriptExecutor::PausableScriptExecutor(
    ScriptState* script_state,
    mojom::blink::UserActivationOption user_activation_option,
    mojom::blink::LoadEventBlockingOption blocking_option,
    mojom::blink::WantResultOption want_result_option,
    mojom::blink::PromiseResultOption promise_result_option,
    WebScriptExecutionCallback callback,
    Executor* executor)
    :{}

PausableScriptExecutor::~PausableScriptExecutor() = default;

void PausableScriptExecutor::Run() {}

void PausableScriptExecutor::RunAsync() {}

void PausableScriptExecutor::PostExecuteAndDestroySelf(
    ExecutionContext* context) {}

void PausableScriptExecutor::ExecuteAndDestroySelf() {}

void PausableScriptExecutor::HandleResults(
    const v8::LocalVector<v8::Value>& results) {}

void PausableScriptExecutor::Dispose() {}

void PausableScriptExecutor::Trace(Visitor* visitor) const {}

}  // namespace blink