2525// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727
28- #pragma once
28+ #ifndef DEPS_CHAKRASHIM_INCLUDE_V8_H_
29+ #define DEPS_CHAKRASHIM_INCLUDE_V8_H_
2930
3031// Stops windows.h from including winsock.h (conflicting with winsock2.h).
3132#ifndef _WINSOCKAPI_
@@ -324,6 +325,7 @@ class Local {
324325 friend class TryCatch ;
325326 friend class UnboundScript ;
326327 friend class Value ;
328+ friend class JSON ;
327329 template <class F > friend class FunctionCallbackInfo ;
328330 template <class F > friend class MaybeLocal ;
329331 template <class F > friend class PersistentBase ;
@@ -364,7 +366,7 @@ class MaybeLocal {
364366 public:
365367 MaybeLocal () : val_(nullptr ) {}
366368 template <class S >
367- MaybeLocal (Local<S> that)
369+ MaybeLocal (Local<S> that) // NOLINT(runtime/explicit)
368370 : val_(reinterpret_cast <T*>(*that)) {
369371 TYPE_CHECK (T, S);
370372 }
@@ -821,6 +823,7 @@ class ScriptOrigin {
821823 V8_INLINE Local<Integer> ScriptID () const {
822824 return script_id_;
823825 }
826+
824827 private:
825828 Local<Value> resource_name_;
826829 Local<Integer> resource_line_offset_;
@@ -886,7 +889,8 @@ class V8_EXPORT ScriptCompiler {
886889 : source_string(source_string), resource_name(origin.ResourceName()) {
887890 }
888891
889- Source (Local<String> source_string, CachedData * cached_data = NULL )
892+ Source (Local<String> source_string, // NOLINT(runtime/explicit)
893+ CachedData * cached_data = NULL )
890894 : source_string(source_string) {
891895 }
892896
@@ -995,7 +999,9 @@ class V8_EXPORT StackFrame {
995999
9961000enum class PromiseHookType { kInit , kResolve , kBefore , kAfter };
9971001
998- typedef void (*PromiseHook)(PromiseHookType type, Local<Promise> promise, Local<Value> parent);
1002+ typedef void (*PromiseHook)(PromiseHookType type,
1003+ Local<Promise> promise,
1004+ Local<Value> parent);
9991005
10001006
10011007class V8_EXPORT Value : public Data {
@@ -1283,7 +1289,7 @@ class V8_EXPORT Symbol : public Name {
12831289 public:
12841290 // Returns the print name string of the symbol, or undefined if none.
12851291 Local<Value> Name () const ;
1286- static Local<Symbol> New (Isolate* isolate,
1292+ static Local<Symbol> New (Isolate* isolate,
12871293 Local<String> name = Local<String>());
12881294 static Symbol* Cast (Value* obj);
12891295
@@ -1354,8 +1360,9 @@ class V8_EXPORT Object : public Value {
13541360 Local<Context> context, Local<Name> key, Local<Value> value,
13551361 PropertyAttribute attributes = None);
13561362
1357- V8_WARN_UNUSED_RESULT Maybe<bool > DefineProperty (
1358- Local<Context> context, Local<Name>, PropertyDescriptor& decriptor);
1363+ V8_WARN_UNUSED_RESULT Maybe<bool > DefineProperty (Local<Context> context,
1364+ Local<Name>,
1365+ PropertyDescriptor& decriptor); // NOLINT(runtime/references)
13591366
13601367 V8_DEPRECATE_SOON (" Use maybe version" ,
13611368 bool ForceSet (Handle<Value> key, Handle<Value> value,
@@ -1764,16 +1771,17 @@ enum class ConstructorBehavior { kThrow, kAllow };
17641771
17651772class V8_EXPORT Function : public Object {
17661773 public:
1767- static MaybeLocal<Function> New (Local<Context> context,
1768- FunctionCallback callback,
1769- Local<Value> data = Local<Value>(),
1770- int length = 0,
1771- ConstructorBehavior behavior = ConstructorBehavior::kAllow);
1774+ static MaybeLocal<Function> New (
1775+ Local<Context> context,
1776+ FunctionCallback callback,
1777+ Local<Value> data = Local<Value>(),
1778+ int length = 0,
1779+ ConstructorBehavior behavior = ConstructorBehavior::kAllow);
17721780 static V8_DEPRECATE_SOON (" Use maybe version" ,
1773- Local<Function> New (Isolate* isolate,
1774- FunctionCallback callback,
1775- Local<Value> data = Local<Value>(),
1776- int length = 0));
1781+ Local<Function> New (Isolate* isolate,
1782+ FunctionCallback callback,
1783+ Local<Value> data = Local<Value>(),
1784+ int length = 0));
17771785
17781786 V8_DEPRECATE_SOON (" Use maybe version" ,
17791787 Local<Object> NewInstance (int argc,
@@ -1847,6 +1855,7 @@ class V8_EXPORT Promise : public Object {
18471855
18481856 bool HasHandler ();
18491857 static Promise* Cast (Value* obj);
1858+
18501859 private:
18511860 Promise ();
18521861};
@@ -2061,17 +2070,32 @@ class V8_EXPORT Float64Array : public TypedArray {
20612070};
20622071
20632072class V8_EXPORT SharedArrayBuffer : public Object {
2064- public:
2073+ public:
20652074 static SharedArrayBuffer* Cast (Value* obj);
20662075
2067- private:
2076+ private:
20682077 SharedArrayBuffer ();
20692078};
20702079
2080+ class V8_EXPORT JSON {
2081+ public:
2082+ static V8_DEPRECATED (" Use the maybe version taking context" ,
2083+ Local<Value> Parse (Local<String> json_string));
2084+ static V8_DEPRECATE_SOON (" Use the maybe version taking context" ,
2085+ MaybeLocal<Value> Parse (Isolate* isolate,
2086+ Local<String> json_string));
2087+ static V8_WARN_UNUSED_RESULT MaybeLocal<Value> Parse (
2088+ Local<Context> context, Local<String> json_string);
2089+
2090+ static V8_WARN_UNUSED_RESULT MaybeLocal<String> Stringify (
2091+ Local<Context> context, Local<Object> json_object,
2092+ Local<String> gap = Local<String>());
2093+ };
2094+
20712095class V8_EXPORT ValueSerializer {
2072- public:
2096+ public:
20732097 class V8_EXPORT Delegate {
2074- public:
2098+ public:
20752099 virtual ~Delegate () {}
20762100
20772101 virtual void ThrowDataCloneError (Local<String> message) = 0;
@@ -2099,15 +2123,15 @@ class V8_EXPORT ValueSerializer {
20992123 void WriteDouble (double value);
21002124 void WriteRawBytes (const void * source, size_t length);
21012125
2102- private:
2126+ private:
21032127 ValueSerializer (const ValueSerializer&) = delete ;
21042128 void operator =(const ValueSerializer&) = delete ;
21052129};
21062130
21072131class V8_EXPORT ValueDeserializer {
2108- public:
2132+ public:
21092133 class V8_EXPORT Delegate {
2110- public:
2134+ public:
21112135 virtual ~Delegate () {}
21122136
21132137 virtual MaybeLocal<Object> ReadHostObject (Isolate* isolate);
@@ -2129,7 +2153,7 @@ class V8_EXPORT ValueDeserializer {
21292153 V8_WARN_UNUSED_RESULT bool ReadDouble (double * value);
21302154 V8_WARN_UNUSED_RESULT bool ReadRawBytes (size_t length, const void ** data);
21312155
2132- private:
2156+ private:
21332157 ValueDeserializer (const ValueDeserializer&) = delete ;
21342158 void operator =(const ValueDeserializer&) = delete ;
21352159};
@@ -2354,7 +2378,7 @@ class V8_EXPORT Exception {
23542378};
23552379
23562380class V8_EXPORT MicrotasksScope {
2357- public:
2381+ public:
23582382 enum Type { kRunMicrotasks , kDoNotRunMicrotasks };
23592383
23602384 MicrotasksScope (Isolate* isolate, Type type);
@@ -2532,8 +2556,11 @@ class V8_EXPORT Isolate {
25322556 };
25332557
25342558 static Isolate* NewWithTTDSupport (const CreateParams& params,
2535- size_t optReplayUriLength, const char * optReplayUri,
2536- bool doRecord, bool doReplay, bool doDebug,
2559+ size_t optReplayUriLength,
2560+ const char * optReplayUri,
2561+ bool doRecord,
2562+ bool doReplay,
2563+ bool doDebug,
25372564 uint32_t snapInterval,
25382565 uint32_t snapHistoryLength);
25392566 static Isolate* New (const CreateParams& params);
@@ -3023,3 +3050,5 @@ Isolate* PropertyCallbackInfo<T>::GetIsolate() const {
30233050}
30243051
30253052} // namespace v8
3053+
3054+ #endif // DEPS_CHAKRASHIM_INCLUDE_V8_H_
0 commit comments