#ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_BINDING_FOR_CORE_H_
#define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_V8_BINDING_FOR_CORE_H_
#include <optional>
#include "base/check_op.h"
#include "third_party/blink/renderer/bindings/core/v8/native_value_traits.h"
#include "third_party/blink/renderer/bindings/core/v8/script_value.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h"
#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"
#include "third_party/blink/renderer/platform/bindings/v8_value_cache.h"
#include "third_party/blink/renderer/platform/heap/heap_traits.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "third_party/blink/renderer/platform/wtf/text/string_view.h"
#include "v8/include/v8.h"
namespace blink {
namespace scheduler {
class EventLoop;
}
class ExceptionState;
class ExecutionContext;
class LocalDOMWindow;
class LocalFrame;
class XPathNSResolver;
class ScriptState;
enum class UnionTypeConversionMode { … };
enum class BlinkState : uint8_t { … };
#define ENTER_EMBEDDER_STATE(isolate, frame, state) …
template <typename CallbackInfo, typename T>
inline void V8SetReturnValue(const CallbackInfo& callbackInfo,
NotShared<T> notShared) { … }
template <typename CallbackInfo, typename T>
inline void V8SetReturnValueFast(const CallbackInfo& callbackInfo,
NotShared<T> notShared,
const ScriptWrappable* wrappable) { … }
template <typename CallbackInfo, typename T>
inline void V8SetReturnValue(const CallbackInfo& callback_info,
MaybeShared<T> maybe_shared) { … }
template <typename CallbackInfo, typename T>
inline void V8SetReturnValueFast(const CallbackInfo& callback_info,
MaybeShared<T> maybe_shared,
const ScriptWrappable* wrappable) { … }
CORE_EXPORT void V8SetReturnValue(const v8::PropertyCallbackInfo<v8::Value>&,
const v8::PropertyDescriptor&);
enum IntegerConversionConfiguration { … };
inline bool ToBoolean(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state) { … }
CORE_EXPORT int8_t ToInt8(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
CORE_EXPORT uint8_t ToUInt8(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
CORE_EXPORT int16_t ToInt16(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
CORE_EXPORT uint16_t ToUInt16(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
CORE_EXPORT int32_t ToInt32Slow(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
inline int32_t ToInt32(v8::Isolate* isolate,
v8::Local<v8::Value> value,
IntegerConversionConfiguration configuration,
ExceptionState& exception_state) { … }
CORE_EXPORT uint32_t ToUInt32Slow(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
inline uint32_t ToUInt32(v8::Isolate* isolate,
v8::Local<v8::Value> value,
IntegerConversionConfiguration configuration,
ExceptionState& exception_state) { … }
CORE_EXPORT int64_t ToInt64Slow(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
inline int64_t ToInt64(v8::Isolate* isolate,
v8::Local<v8::Value> value,
IntegerConversionConfiguration configuration,
ExceptionState& exception_state) { … }
CORE_EXPORT uint64_t ToUInt64Slow(v8::Isolate*,
v8::Local<v8::Value>,
IntegerConversionConfiguration,
ExceptionState&);
inline uint64_t ToUInt64(v8::Isolate* isolate,
v8::Local<v8::Value> value,
IntegerConversionConfiguration configuration,
ExceptionState& exception_state) { … }
inline uint64_t DoubleToInteger(double d) { … }
CORE_EXPORT double ToDoubleSlow(v8::Isolate*,
v8::Local<v8::Value>,
ExceptionState&);
inline double ToDouble(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state) { … }
CORE_EXPORT double ToRestrictedDouble(v8::Isolate*,
v8::Local<v8::Value>,
ExceptionState&);
inline float ToFloat(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state) { … }
CORE_EXPORT float ToRestrictedFloat(v8::Isolate*,
v8::Local<v8::Value>,
ExceptionState&);
inline std::optional<base::Time> ToCoreNullableDate(
v8::Isolate* isolate,
v8::Local<v8::Value> object,
ExceptionState& exception_state) { … }
CORE_EXPORT String ReplaceUnmatchedSurrogates(String);
XPathNSResolver* ToXPathNSResolver(ScriptState*, v8::Local<v8::Value>);
template <typename IDLType>
VectorOf<typename NativeValueTraits<IDLType>::ImplType> ToImplArguments(
const v8::FunctionCallbackInfo<v8::Value>& info,
int start_index,
ExceptionState& exception_state) { … }
template <typename IDLType>
VectorOf<typename NativeValueTraits<IDLType>::ImplType> ToImplArguments(
const v8::FunctionCallbackInfo<v8::Value>& info,
int start_index,
ExceptionState& exception_state,
ExecutionContext* execution_context) { … }
CORE_EXPORT v8::Local<v8::Function> GetEsIteratorMethod(v8::Isolate*,
v8::Local<v8::Object>,
ExceptionState&);
CORE_EXPORT v8::Local<v8::Object> GetEsIteratorWithMethod(
v8::Isolate*,
v8::Local<v8::Function>,
v8::Local<v8::Object>,
ExceptionState&);
CORE_EXPORT bool HasCallableIteratorSymbol(v8::Isolate*,
v8::Local<v8::Value>,
ExceptionState&);
CORE_EXPORT v8::Isolate* ToIsolate(const LocalFrame*);
CORE_EXPORT LocalDOMWindow* ToLocalDOMWindow(const ScriptState*);
CORE_EXPORT ExecutionContext* ToExecutionContext(const ScriptState*);
CORE_EXPORT LocalDOMWindow* ToLocalDOMWindow(v8::Local<v8::Context>);
CORE_EXPORT LocalDOMWindow* EnteredDOMWindow(v8::Isolate*);
LocalDOMWindow* IncumbentDOMWindow(v8::Isolate*);
CORE_EXPORT LocalDOMWindow* CurrentDOMWindow(v8::Isolate*);
CORE_EXPORT ExecutionContext* ToExecutionContext(v8::Local<v8::Context>);
CORE_EXPORT void RegisterToExecutionContextForModules(ExecutionContext* (
*to_execution_context_for_modules)(v8::Local<v8::Context>));
CORE_EXPORT ExecutionContext* CurrentExecutionContext(v8::Isolate*);
CORE_EXPORT v8::Local<v8::Context> ToV8Context(ExecutionContext*,
DOMWrapperWorld&);
CORE_EXPORT v8::Local<v8::Context> ToV8Context(LocalFrame*, DOMWrapperWorld&);
CORE_EXPORT v8::Local<v8::Context> ToV8ContextEvenIfDetached(LocalFrame*,
DOMWrapperWorld&);
CORE_EXPORT v8::Local<v8::Context> ToV8ContextMaybeEmpty(LocalFrame*,
DOMWrapperWorld&);
CORE_EXPORT ScriptState* ToScriptState(ExecutionContext*, DOMWrapperWorld&);
CORE_EXPORT ScriptState* ToScriptState(LocalFrame*, DOMWrapperWorld&);
CORE_EXPORT ScriptState* ToScriptStateForMainWorld(ExecutionContext*);
CORE_EXPORT ScriptState* ToScriptStateForMainWorld(LocalFrame*);
CORE_EXPORT LocalFrame* ToLocalFrameIfNotDetached(v8::Local<v8::Context>);
CORE_EXPORT bool IsValidEnum(const String& value,
const char* const* valid_values,
size_t length,
const String& enum_name,
ExceptionState&);
CORE_EXPORT bool IsValidEnum(const Vector<String>& values,
const char* const* valid_values,
size_t length,
const String& enum_name,
ExceptionState&);
CORE_EXPORT v8::Local<v8::Value> FromJSONString(v8::Isolate*,
v8::Local<v8::Context>,
const String& stringified_json,
ExceptionState&);
CORE_EXPORT v8::Local<v8::Value> FromJSONString(v8::Isolate*,
v8::Local<v8::Context>,
const String& stringified_json,
TryRethrowScope&);
template <typename NotSharedType>
NotSharedType ToNotShared(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state) { … }
template <typename MaybeSharedType>
MaybeSharedType ToMaybeShared(v8::Isolate* isolate,
v8::Local<v8::Value> value,
ExceptionState& exception_state) { … }
CORE_EXPORT Vector<String> GetOwnPropertyNames(v8::Isolate*,
const v8::Local<v8::Object>&,
ExceptionState&);
CORE_EXPORT v8::MicrotaskQueue* ToMicrotaskQueue(ExecutionContext*);
CORE_EXPORT v8::MicrotaskQueue* ToMicrotaskQueue(ScriptState*);
CORE_EXPORT scheduler::EventLoop& ToEventLoop(ExecutionContext*);
CORE_EXPORT scheduler::EventLoop& ToEventLoop(ScriptState*);
CORE_EXPORT bool IsInParallelAlgorithmRunnable(
ExecutionContext* execution_context,
ScriptState* script_state);
CORE_EXPORT void ApplyContextToException(ScriptState*,
v8::Local<v8::Value> exception,
const ExceptionContext&);
}
#endif