V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
value-mirror.h
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 
10 #include "src/base/macros.h"
11 #include "src/inspector/protocol/Protocol.h"
12 #include "src/inspector/protocol/Runtime.h"
13 #include "src/inspector/string-16.h"
14 
15 #include "include/v8-inspector.h"
16 #include "include/v8.h"
17 
18 namespace v8_inspector {
19 
20 class ValueMirror;
21 enum class WrapMode;
22 
24  String16 name;
25  std::unique_ptr<ValueMirror> value;
26 };
27 
29  String16 name;
30  bool writable;
31  bool configurable;
32  bool enumerable;
33  bool isOwn;
34  bool isIndex;
35  std::unique_ptr<ValueMirror> value;
36  std::unique_ptr<ValueMirror> getter;
37  std::unique_ptr<ValueMirror> setter;
38  std::unique_ptr<ValueMirror> symbol;
39  std::unique_ptr<ValueMirror> exception;
40 };
41 
42 class ValueMirror {
43  public:
44  virtual ~ValueMirror();
45 
46  static std::unique_ptr<ValueMirror> create(v8::Local<v8::Context> context,
47  v8::Local<v8::Value> value);
48  virtual protocol::Response buildRemoteObject(
49  v8::Local<v8::Context> context, WrapMode mode,
50  std::unique_ptr<protocol::Runtime::RemoteObject>* result) = 0;
51  virtual void buildPropertyPreview(
52  v8::Local<v8::Context> context, const String16& name,
53  std::unique_ptr<protocol::Runtime::PropertyPreview>*) {}
54  virtual void buildObjectPreview(
55  v8::Local<v8::Context> context, bool generatePreviewForTable,
56  int* nameLimit, int* indexLimit,
57  std::unique_ptr<protocol::Runtime::ObjectPreview>*) {}
58  virtual void buildEntryPreview(
59  v8::Local<v8::Context> context, int* nameLimit, int* indexLimit,
60  std::unique_ptr<protocol::Runtime::ObjectPreview>*) {}
61  virtual v8::Local<v8::Value> v8Value() = 0;
62 
64  public:
65  virtual ~PropertyAccumulator() = default;
66  virtual bool Add(PropertyMirror mirror) = 0;
67  };
68  static bool getProperties(v8::Local<v8::Context> context,
69  v8::Local<v8::Object> object, bool ownProperties,
70  bool accessorPropertiesOnly,
71  PropertyAccumulator* accumulator);
72  static void getInternalProperties(
74  std::vector<InternalPropertyMirror>* mirrors);
75 };
76 } // namespace v8_inspector
77 
78 #endif // V8_INSPECTOR_VALUE_MIRROR_H_