#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/renderer/v8_value_converter_impl.h"
#include <stddef.h>
#include <stdint.h>
#include <cmath>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/containers/span.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/values.h"
#include "v8/include/v8-array-buffer.h"
#include "v8/include/v8-container.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-date.h"
#include "v8/include/v8-exception.h"
#include "v8/include/v8-isolate.h"
#include "v8/include/v8-local-handle.h"
#include "v8/include/v8-object.h"
#include "v8/include/v8-primitive.h"
namespace content {
bool V8ValueConverter::Strategy::FromV8Object(v8::Local<v8::Object> value,
std::unique_ptr<base::Value>* out,
v8::Isolate* isolate) { … }
bool V8ValueConverter::Strategy::FromV8Array(v8::Local<v8::Array> value,
std::unique_ptr<base::Value>* out,
v8::Isolate* isolate) { … }
bool V8ValueConverter::Strategy::FromV8ArrayBuffer(
v8::Local<v8::Object> value,
std::unique_ptr<base::Value>* out,
v8::Isolate* isolate) { … }
bool V8ValueConverter::Strategy::FromV8Number(
v8::Local<v8::Number> value,
std::unique_ptr<base::Value>* out) { … }
bool V8ValueConverter::Strategy::FromV8Undefined(
std::unique_ptr<base::Value>* out) { … }
namespace {
const int kMaxRecursionDepth = …;
}
class V8ValueConverterImpl::FromV8ValueState { … };
class V8ValueConverterImpl::ScopedUniquenessGuard { … };
std::unique_ptr<V8ValueConverter> V8ValueConverter::Create() { … }
V8ValueConverterImpl::V8ValueConverterImpl()
: … { … }
void V8ValueConverterImpl::SetDateAllowed(bool val) { … }
void V8ValueConverterImpl::SetRegExpAllowed(bool val) { … }
void V8ValueConverterImpl::SetFunctionAllowed(bool val) { … }
void V8ValueConverterImpl::SetStripNullFromObjects(bool val) { … }
void V8ValueConverterImpl::SetConvertNegativeZeroToInt(bool val) { … }
void V8ValueConverterImpl::SetStrategy(Strategy* strategy) { … }
v8::Local<v8::Value> V8ValueConverterImpl::ToV8Value(
base::ValueView value,
v8::Local<v8::Context> context) { … }
std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8Value(
v8::Local<v8::Value> val,
v8::Local<v8::Context> context) { … }
v8::Local<v8::Value> V8ValueConverterImpl::ToV8ValueImpl(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context,
base::ValueView value) const { … }
v8::Local<v8::Value> V8ValueConverterImpl::ToV8Array(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context,
const base::Value::List& val) const { … }
v8::Local<v8::Value> V8ValueConverterImpl::ToV8Object(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context,
const base::Value::Dict& val) const { … }
v8::Local<v8::Value> V8ValueConverterImpl::ToArrayBuffer(
v8::Isolate* isolate,
v8::Local<v8::Object> creation_context,
const base::Value::BlobStorage& value) const { … }
std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8ValueImpl(
FromV8ValueState* state,
v8::Local<v8::Value> val,
v8::Isolate* isolate) const { … }
std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8Array(
v8::Local<v8::Array> val,
FromV8ValueState* state,
v8::Isolate* isolate) const { … }
std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8ArrayBuffer(
v8::Local<v8::Object> val,
v8::Isolate* isolate) const { … }
std::unique_ptr<base::Value> V8ValueConverterImpl::FromV8Object(
v8::Local<v8::Object> val,
FromV8ValueState* state,
v8::Isolate* isolate) const { … }
}