#include "content/services/auction_worklet/webidl_compat.h"
#include <cmath>
#include <initializer_list>
#include "base/check.h"
#include "base/functional/callback.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/services/auction_worklet/auction_v8_helper.h"
#include "gin/converter.h"
#include "v8/include/v8-exception.h"
#include "v8/include/v8-primitive.h"
namespace auction_worklet {
namespace {
IdlConvert::Status MakeRecordConversionFailure(
const v8::TryCatch& try_catch,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject) { … }
IdlConvert::Status MakeIterFailure(
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
const v8::TryCatch& catcher) { … }
}
const size_t IdlConvert::kSequenceLengthLimit;
IdlConvert::Status::Status() : … { … }
IdlConvert::Status::Status(Status&& other) = default;
IdlConvert::Status::~Status() = default;
IdlConvert::Status& IdlConvert::Status::operator=(Status&&) = default;
std::string IdlConvert::Status::ConvertToErrorString(
v8::Isolate* isolate) const { … }
void IdlConvert::Status::PropagateErrorsToV8(AuctionV8Helper* v8_helper) { … }
IdlConvert::Status::Status(StatusValue value) : … { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
UnrestrictedDouble& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
double& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
bool& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
std::string& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
std::u16string& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
v8::Local<v8::BigInt>& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
int32_t& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
uint32_t& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
absl::variant<int32_t, v8::Local<v8::BigInt>>& out) { … }
IdlConvert::Status IdlConvert::Convert(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> value,
v8::Local<v8::Value>& out) { … }
IdlConvert::Status IdlConvert::MakeConversionFailure(
const v8::TryCatch& catcher,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
std::string_view type_name) { … }
IdlConvert::Status ConvertRecord(
AuctionV8Helper* v8_helper,
AuctionV8Helper::TimeLimitScope& time_limit_scope,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Value> in_val,
std::vector<std::pair<std::string, std::string>>& out) { … }
DictConverter::DictConverter(AuctionV8Helper* v8_helper,
AuctionV8Helper::TimeLimitScope& time_limit_scope,
std::string error_prefix,
v8::Local<v8::Value> value)
: … { … }
DictConverter::~DictConverter() = default;
bool DictConverter::GetOptionalSequence(
std::string_view field,
base::OnceClosure exists_callback,
base::RepeatingCallback<IdlConvert::Status(v8::Local<v8::Value>)>
item_callback) { … }
std::string DictConverter::ErrorMessage() const { … }
v8::MaybeLocal<v8::Value> DictConverter::FailureException() const { … }
bool DictConverter::FailureIsTimeout() const { … }
void DictConverter::SetStatus(IdlConvert::Status status) { … }
v8::Local<v8::Value> DictConverter::GetMember(std::string_view field) { … }
IdlConvert::Status IdlConvert::CheckForSequence(
v8::Isolate* isolate,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Object> maybe_iterable,
v8::Local<v8::Object>& result) { … }
IdlConvert::Status IdlConvert::ConvertSequence(
AuctionV8Helper* v8_helper,
std::string_view error_prefix,
std::initializer_list<std::string_view> error_subject,
v8::Local<v8::Object> iterable,
v8::Local<v8::Object> method,
base::RepeatingCallback<IdlConvert::Status(v8::Local<v8::Value>)>
item_callback) { … }
void DictConverter::MarkFailed(std::string_view fail_message) { … }
void DictConverter::MarkFailedWithTimeout(std::string_view fail_message) { … }
void DictConverter::MarkFailedWithException(const v8::TryCatch& catcher) { … }
ArgsConverter::ArgsConverter(AuctionV8Helper* v8_helper,
AuctionV8Helper::TimeLimitScope& time_limit_scope,
std::string error_prefix,
const v8::FunctionCallbackInfo<v8::Value>* args,
int min_required_args)
: … { … }
ArgsConverter::~ArgsConverter() = default;
void ArgsConverter::SetStatus(IdlConvert::Status status) { … }
}