#include "src/inspector/value-mirror.h"
#include <algorithm>
#include <cmath>
#include <optional>
#include "include/v8-container.h"
#include "include/v8-date.h"
#include "include/v8-function.h"
#include "include/v8-microtask-queue.h"
#include "include/v8-primitive-object.h"
#include "include/v8-proxy.h"
#include "include/v8-regexp.h"
#include "include/v8-typed-array.h"
#include "include/v8-wasm.h"
#include "src/debug/debug-interface.h"
#include "src/inspector/v8-debugger.h"
#include "src/inspector/v8-deep-serializer.h"
#include "src/inspector/v8-inspector-impl.h"
#include "src/inspector/v8-serialization-duplicate-tracker.h"
namespace v8_inspector {
Response;
EntryPreview;
ObjectPreview;
PropertyPreview;
RemoteObject;
#if defined(V8_USE_ADDRESS_SANITIZER) && V8_OS_DARWIN
static const int kMaxProtocolDepth = 900;
#else
static const int kMaxProtocolDepth = …;
#endif
Response toProtocolValue(v8::Local<v8::Context> context,
v8::Local<v8::Value> value, int maxDepth,
std::unique_ptr<protocol::Value>* result);
Response arrayToProtocolValue(v8::Local<v8::Context> context,
v8::Local<v8::Array> array, int maxDepth,
std::unique_ptr<protocol::ListValue>* result) { … }
Response objectToProtocolValue(
v8::Local<v8::Context> context, v8::Local<v8::Object> object, int maxDepth,
std::unique_ptr<protocol::DictionaryValue>* result) { … }
std::unique_ptr<protocol::FundamentalValue> toProtocolValue(
double doubleValue) { … }
Response toProtocolValue(v8::Local<v8::Context> context,
v8::Local<v8::Value> value, int maxDepth,
std::unique_ptr<protocol::Value>* result) { … }
Response toProtocolValue(v8::Local<v8::Context> context,
v8::Local<v8::Value> value,
std::unique_ptr<protocol::Value>* result) { … }
namespace {
const size_t kWasmPageSize = …;
V8InspectorClient* clientFor(v8::Local<v8::Context> context) { … }
V8InternalValueType v8InternalValueTypeFrom(v8::Local<v8::Context> context,
v8::Local<v8::Value> value) { … }
enum AbbreviateMode { … };
String16 abbreviateString(const String16& value, AbbreviateMode mode) { … }
String16 descriptionForSymbol(v8::Local<v8::Context> context,
v8::Local<v8::Symbol> symbol) { … }
String16 descriptionForBigInt(v8::Local<v8::Context> context,
v8::Local<v8::BigInt> value) { … }
String16 descriptionForPrimitiveType(v8::Local<v8::Context> context,
v8::Local<v8::Value> value) { … }
String16 descriptionForRegExp(v8::Isolate* isolate,
v8::Local<v8::RegExp> value) { … }
String16 descriptionForError(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) { … }
String16 descriptionForObject(v8::Isolate* isolate,
v8::Local<v8::Object> object) { … }
String16 descriptionForProxy(v8::Isolate* isolate, v8::Local<v8::Proxy> proxy) { … }
String16 descriptionForDate(v8::Local<v8::Context> context,
v8::Local<v8::Date> date) { … }
String16 descriptionForScopeList(v8::Local<v8::Array> list) { … }
String16 descriptionForScope(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) { … }
String16 descriptionForCollection(v8::Isolate* isolate,
v8::Local<v8::Object> object, size_t length) { … }
#if V8_ENABLE_WEBASSEMBLY
String16 descriptionForWasmValueObject(
v8::Local<v8::Context> context,
v8::Local<v8::debug::WasmValueObject> object) { … }
#endif
String16 descriptionForEntry(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) { … }
String16 descriptionForFunction(v8::Local<v8::Function> value) { … }
String16 descriptionForPrivateMethodList(v8::Local<v8::Array> list) { … }
String16 descriptionForPrivateMethod(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) { … }
String16 descriptionForNumber(v8::Local<v8::Number> value,
bool* unserializable) { … }
class ValueMirrorBase : public ValueMirror { … };
class PrimitiveValueMirror final : public ValueMirrorBase { … };
class NumberMirror final : public ValueMirrorBase { … };
class BigIntMirror final : public ValueMirrorBase { … };
class SymbolMirror final : public ValueMirrorBase { … };
class LocationMirror final : public ValueMirrorBase { … };
class FunctionMirror final : public ValueMirrorBase { … };
bool isArrayLike(v8::Local<v8::Context> context, v8::Local<v8::Object> object,
size_t* length) { … }
struct EntryMirror { … };
class PreviewPropertyAccumulator : public ValueMirror::PropertyAccumulator { … };
bool getPropertiesForPreview(v8::Local<v8::Context> context,
v8::Local<v8::Object> object, int* nameLimit,
int* indexLimit, bool* overflow,
std::vector<PropertyMirror>* properties) { … }
void getInternalPropertiesForPreview(
v8::Local<v8::Context> context, v8::Local<v8::Object> object,
int* nameLimit, bool* overflow,
std::vector<InternalPropertyMirror>* properties) { … }
void getPrivatePropertiesForPreview(
v8::Local<v8::Context> context, v8::Local<v8::Object> object,
int* nameLimit, bool* overflow,
protocol::Array<PropertyPreview>* privateProperties) { … }
class ObjectMirror final : public ValueMirrorBase { … };
void nativeGetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
std::unique_ptr<ValueMirror> createNativeGetter(v8::Local<v8::Context> context,
v8::Local<v8::Value> object,
v8::Local<v8::Name> name) { … }
void nativeSetterCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
std::unique_ptr<ValueMirror> createNativeSetter(v8::Local<v8::Context> context,
v8::Local<v8::Value> object,
v8::Local<v8::Name> name) { … }
bool doesAttributeHaveObservableSideEffectOnGet(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
v8::Local<v8::Name> name) { … }
}
ValueMirror::~ValueMirror() = default;
bool ValueMirror::getProperties(v8::Local<v8::Context> context,
v8::Local<v8::Object> object,
bool ownProperties, bool accessorPropertiesOnly,
bool nonIndexedPropertiesOnly,
PropertyAccumulator* accumulator) { … }
void ValueMirror::getInternalProperties(
v8::Local<v8::Context> context, v8::Local<v8::Object> object,
std::vector<InternalPropertyMirror>* mirrors) { … }
std::vector<PrivatePropertyMirror> ValueMirror::getPrivateProperties(
v8::Local<v8::Context> context, v8::Local<v8::Object> object,
bool accessorPropertiesOnly) { … }
std::unique_ptr<ValueMirror> clientMirror(v8::Local<v8::Context> context,
v8::Local<v8::Object> value,
const String16& subtype) { … }
std::unique_ptr<ValueMirror> ValueMirror::create(v8::Local<v8::Context> context,
v8::Local<v8::Value> value) { … }
}