File indexing completed on 2026-09-13 09:14:36
0001
0002
0003
0004
0005 #ifndef INCLUDE_V8_EXTERNAL_H_
0006 #define INCLUDE_V8_EXTERNAL_H_
0007
0008 #include "v8-value.h" // NOLINT(build/include_directory)
0009 #include "v8config.h" // NOLINT(build/include_directory)
0010
0011 namespace v8 {
0012
0013 class Isolate;
0014
0015
0016
0017
0018
0019
0020
0021 using ExternalPointerTypeTag = uint16_t;
0022
0023 constexpr ExternalPointerTypeTag kExternalPointerTypeTagDefault = 0;
0024
0025
0026
0027
0028
0029 class V8_EXPORT External : public Value {
0030 public:
0031 V8_DEPRECATED("Use the version with the type tag.")
0032 static Local<External> New(Isolate* isolate, void* value) {
0033 return New(isolate, value, kExternalPointerTypeTagDefault);
0034 }
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 static Local<External> New(Isolate* isolate, void* value,
0046 ExternalPointerTypeTag tag);
0047 V8_INLINE static External* Cast(Data* value) {
0048 #ifdef V8_ENABLE_CHECKS
0049 CheckCast(value);
0050 #endif
0051 return static_cast<External*>(value);
0052 }
0053
0054 V8_DEPRECATED("Use the version with the type tag.")
0055 void* Value() const { return Value(kExternalPointerTypeTagDefault); }
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 void* Value(ExternalPointerTypeTag tag) const;
0066
0067 private:
0068 static void CheckCast(v8::Data* obj);
0069 };
0070
0071 }
0072
0073 #endif