v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
value-mirror.h
Go to the documentation of this file.
1// Copyright 2018 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_INSPECTOR_VALUE_MIRROR_H_
6#define V8_INSPECTOR_VALUE_MIRROR_H_
7
8#include <memory>
9
12#include "src/base/macros.h"
13#include "src/inspector/protocol/Protocol.h"
14#include "src/inspector/protocol/Runtime.h"
18
19namespace v8_inspector {
20
21class ValueMirror;
22
25 std::unique_ptr<ValueMirror> value;
26 std::unique_ptr<ValueMirror> getter;
27 std::unique_ptr<ValueMirror> setter;
28};
29
32 std::unique_ptr<ValueMirror> value;
33};
34
40 bool isOwn;
41 bool isIndex;
43 std::unique_ptr<ValueMirror> value;
44 std::unique_ptr<ValueMirror> getter;
45 std::unique_ptr<ValueMirror> setter;
46 std::unique_ptr<ValueMirror> symbol;
47 std::unique_ptr<ValueMirror> exception;
48};
49
51 public:
52 virtual ~ValueMirror();
53
54 static std::unique_ptr<ValueMirror> create(v8::Local<v8::Context> context,
56 virtual protocol::Response buildRemoteObject(
57 v8::Local<v8::Context> context, const WrapOptions& wrapOptions,
58 std::unique_ptr<protocol::Runtime::RemoteObject>* result) const = 0;
60 v8::Local<v8::Context> context, const String16& name,
61 std::unique_ptr<protocol::Runtime::PropertyPreview>*) const {}
62 virtual void buildObjectPreview(
63 v8::Local<v8::Context> context, bool generatePreviewForTable,
64 int* nameLimit, int* indexLimit,
65 std::unique_ptr<protocol::Runtime::ObjectPreview>*) const {}
66 virtual void buildEntryPreview(
67 v8::Local<v8::Context> context, int* nameLimit, int* indexLimit,
68 std::unique_ptr<protocol::Runtime::ObjectPreview>*) const {}
69 virtual v8::Local<v8::Value> v8Value(v8::Isolate* isolate) const = 0;
70 // https://goo.gle/browser-automation-deepserialization
71 virtual Response buildDeepSerializedValue(
72 v8::Local<v8::Context> context, int maxDepth,
73 v8::Local<v8::Object> additionalParameters,
74 V8SerializationDuplicateTracker& duplicateTracker,
75 std::unique_ptr<protocol::DictionaryValue>* result) const = 0;
76
78 public:
79 virtual ~PropertyAccumulator() = default;
80 virtual bool Add(PropertyMirror mirror) = 0;
81 };
82 static bool getProperties(v8::Local<v8::Context> context,
83 v8::Local<v8::Object> object, bool ownProperties,
84 bool accessorPropertiesOnly,
85 bool nonIndexedPropertiesOnly,
86 PropertyAccumulator* accumulator);
87 static void getInternalProperties(
89 std::vector<InternalPropertyMirror>* mirrors);
90 static std::vector<PrivatePropertyMirror> getPrivateProperties(
92 bool accessorPropertiesOnly);
93};
94
95protocol::Response toProtocolValue(v8::Local<v8::Context> context,
96 v8::Local<v8::Value> value, int maxDepth,
97 std::unique_ptr<protocol::Value>* result);
98protocol::Response arrayToProtocolValue(
99 v8::Local<v8::Context> context, v8::Local<v8::Array> array, int maxDepth,
100 std::unique_ptr<protocol::ListValue>* result);
101protocol::Response objectToProtocolValue(
102 v8::Local<v8::Context> context, v8::Local<v8::Object> object, int maxDepth,
103 std::unique_ptr<protocol::DictionaryValue>* result);
104
105} // namespace v8_inspector
106
107#endif // V8_INSPECTOR_VALUE_MIRROR_H_
virtual bool Add(PropertyMirror mirror)=0
static std::unique_ptr< ValueMirror > create(v8::Local< v8::Context > context, v8::Local< v8::Value > value)
virtual v8::Local< v8::Value > v8Value(v8::Isolate *isolate) const =0
virtual Response buildDeepSerializedValue(v8::Local< v8::Context > context, int maxDepth, v8::Local< v8::Object > additionalParameters, V8SerializationDuplicateTracker &duplicateTracker, std::unique_ptr< protocol::DictionaryValue > *result) const =0
static bool getProperties(v8::Local< v8::Context > context, v8::Local< v8::Object > object, bool ownProperties, bool accessorPropertiesOnly, bool nonIndexedPropertiesOnly, PropertyAccumulator *accumulator)
virtual void buildEntryPreview(v8::Local< v8::Context > context, int *nameLimit, int *indexLimit, std::unique_ptr< protocol::Runtime::ObjectPreview > *) const
virtual protocol::Response buildRemoteObject(v8::Local< v8::Context > context, const WrapOptions &wrapOptions, std::unique_ptr< protocol::Runtime::RemoteObject > *result) const =0
virtual void buildObjectPreview(v8::Local< v8::Context > context, bool generatePreviewForTable, int *nameLimit, int *indexLimit, std::unique_ptr< protocol::Runtime::ObjectPreview > *) const
static void getInternalProperties(v8::Local< v8::Context > context, v8::Local< v8::Object > object, std::vector< InternalPropertyMirror > *mirrors)
virtual void buildPropertyPreview(v8::Local< v8::Context > context, const String16 &name, std::unique_ptr< protocol::Runtime::PropertyPreview > *) const
static std::vector< PrivatePropertyMirror > getPrivateProperties(v8::Local< v8::Context > context, v8::Local< v8::Object > object, bool accessorPropertiesOnly)
ZoneVector< RpoNumber > & result
Response toProtocolValue(v8::Local< v8::Context > context, v8::Local< v8::Value > value, int maxDepth, std::unique_ptr< protocol::Value > *result)
Response objectToProtocolValue(v8::Local< v8::Context > context, v8::Local< v8::Object > object, int maxDepth, std::unique_ptr< protocol::DictionaryValue > *result)
Response arrayToProtocolValue(v8::Local< v8::Context > context, v8::Local< v8::Array > array, int maxDepth, std::unique_ptr< protocol::ListValue > *result)
std::unique_ptr< ValueMirror > value
std::unique_ptr< ValueMirror > getter
std::unique_ptr< ValueMirror > value
std::unique_ptr< ValueMirror > setter
std::unique_ptr< ValueMirror > symbol
std::unique_ptr< ValueMirror > value
std::unique_ptr< ValueMirror > getter
std::unique_ptr< ValueMirror > exception
std::unique_ptr< ValueMirror > setter