Loading...
Searching...
No Matches
v8-external.h
Go to the documentation of this file.
1// Copyright 2021 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 INCLUDE_V8_EXTERNAL_H_
6#define INCLUDE_V8_EXTERNAL_H_
7
8#include "v8-value.h" // NOLINT(build/include_directory)
9#include "v8config.h" // NOLINT(build/include_directory)
10
11namespace v8 {
12
13class Isolate;
14
21using ExternalPointerTypeTag = uint16_t;
22
24
29class V8_EXPORT External : public Value {
30 public:
31 V8_DEPRECATE_SOON("Use the version with the type tag.")
32 static Local<External> New(Isolate* isolate, void* value) {
33 return New(isolate, value, kExternalPointerTypeTagDefault);
34 }
35 static Local<External> New(Isolate* isolate, void* value,
37 V8_INLINE static External* Cast(Value* value) {
38#ifdef V8_ENABLE_CHECKS
39 CheckCast(value);
40#endif
41 return static_cast<External*>(value);
42 }
43
44 V8_DEPRECATE_SOON("Use the version with the type tag.")
45 void* Value() const { return Value(kExternalPointerTypeTagDefault); }
46
47 void* Value(ExternalPointerTypeTag tag) const;
48
49 private:
50 static void CheckCast(v8::Value* obj);
51};
52
53} // namespace v8
54
55#endif // INCLUDE_V8_EXTERNAL_H_
Definition: v8-external.h:29
void * Value() const
Definition: v8-external.h:45
static Local< External > New(Isolate *isolate, void *value, ExternalPointerTypeTag tag)
void * Value(ExternalPointerTypeTag tag) const
static External * Cast(Value *value)
Definition: v8-external.h:37
Definition: v8-isolate.h:290
Definition: v8-local-handle.h:366
Definition: v8-value.h:32
Definition: libplatform.h:15
uint16_t ExternalPointerTypeTag
Definition: v8-external.h:21
constexpr ExternalPointerTypeTag kExternalPointerTypeTagDefault
Definition: v8-external.h:23
#define V8_EXPORT
Definition: v8config.h:855
#define V8_INLINE
Definition: v8config.h:508
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:622