v8
13.6.233 (node 24.1.0)
V8 is Google's open source JavaScript engine
Toggle main menu visibility
Main Page
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Functions
a
c
d
e
f
g
i
j
k
m
n
o
p
r
s
t
u
v
Variables
f
g
i
k
m
t
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
e
g
h
i
j
k
l
m
n
p
s
t
w
Enumerator
a
b
c
d
e
g
i
j
k
l
n
o
p
r
s
Concepts
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
~
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
a
b
c
d
g
i
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
Enumerator
b
c
d
e
h
j
k
n
o
p
r
s
t
u
w
Related Symbols
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Files
File List
Globals
All
a
c
d
e
p
s
v
Macros
a
c
d
e
p
s
v
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Concepts
Loading...
Searching...
No Matches
v8-weak-callback-info.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_WEAK_CALLBACK_INFO_H_
6
#define INCLUDE_V8_WEAK_CALLBACK_INFO_H_
7
8
#include <cstring>
9
10
#include "
cppgc/internal/conditional-stack-allocated.h
"
// NOLINT(build/include_directory)
11
#include "
v8config.h
"
// NOLINT(build/include_directory)
12
13
namespace
v8
{
14
15
class
Isolate
;
16
17
namespace
api_internal
{
18
V8_EXPORT
void
InternalFieldOutOfBounds
(
int
index);
19
}
// namespace api_internal
20
21
static
constexpr
int
kInternalFieldsInWeakCallback = 2;
22
static
constexpr
int
kEmbedderFieldsInWeakCallback = 2;
23
24
template
<
typename
T>
25
class
WeakCallbackInfo
26
:
public
cppgc::internal::ConditionalStackAllocatedBase
<T> {
27
public
:
28
using
Callback
= void (*)(
const
WeakCallbackInfo<T>
& data);
29
30
WeakCallbackInfo
(
Isolate
* isolate, T* parameter,
31
void
* embedder_fields[kEmbedderFieldsInWeakCallback],
32
Callback
* callback)
33
: isolate_(isolate), parameter_(parameter), callback_(callback) {
34
memcpy(embedder_fields_, embedder_fields,
35
sizeof
(embedder_fields[0]) * kEmbedderFieldsInWeakCallback);
36
}
30
WeakCallbackInfo
(
Isolate
* isolate, T* parameter, {
…
}
37
38
V8_INLINE
Isolate
*
GetIsolate
()
const
{
return
isolate_; }
39
V8_INLINE
T*
GetParameter
()
const
{
return
parameter_; }
40
V8_INLINE
void
*
GetInternalField
(
int
index)
const
;
41
53
void
SetSecondPassCallback
(
Callback
callback)
const
{ *callback_ = callback; }
54
55
private
:
56
Isolate
* isolate_;
57
T* parameter_;
58
Callback
* callback_;
59
void
* embedder_fields_[kEmbedderFieldsInWeakCallback];
60
};
25
class
WeakCallbackInfo
{
…
};
61
65
enum class
WeakCallbackType
{
69
kParameter
,
73
kInternalFields
,
74
};
65
enum class
WeakCallbackType
{
…
};
75
76
template
<
class
T>
77
void
*
WeakCallbackInfo<T>::GetInternalField
(
int
index)
const
{
78
#ifdef V8_ENABLE_CHECKS
79
if
(index < 0 || index >= kEmbedderFieldsInWeakCallback) {
80
api_internal::InternalFieldOutOfBounds
(index);
81
}
82
#endif
83
return
embedder_fields_[index];
84
}
77
void
*
WeakCallbackInfo<T>::GetInternalField
(
int
index)
const
{
…
}
85
86
}
// namespace v8
87
88
#endif
// INCLUDE_V8_WEAK_CALLBACK_INFO_H_
cppgc::internal::ConditionalStackAllocatedBase
Definition
conditional-stack-allocated.h:19
v8::Isolate
Definition
v8-isolate.h:274
v8::WeakCallbackInfo::WeakCallbackInfo
WeakCallbackInfo(Isolate *isolate, T *parameter, void *embedder_fields[kEmbedderFieldsInWeakCallback], Callback *callback)
Definition
v8-weak-callback-info.h:30
v8::WeakCallbackInfo::GetParameter
V8_INLINE T * GetParameter() const
Definition
v8-weak-callback-info.h:39
v8::WeakCallbackInfo::SetSecondPassCallback
void SetSecondPassCallback(Callback callback) const
Definition
v8-weak-callback-info.h:53
v8::WeakCallbackInfo::GetIsolate
V8_INLINE Isolate * GetIsolate() const
Definition
v8-weak-callback-info.h:38
v8::WeakCallbackInfo::Callback
void(*)(const WeakCallbackInfo< T > &data) Callback
Definition
v8-weak-callback-info.h:28
v8::WeakCallbackInfo::GetInternalField
V8_INLINE void * GetInternalField(int index) const
Definition
v8-weak-callback-info.h:77
conditional-stack-allocated.h
v8::api_internal
Definition
v8-function-callback.h:35
v8::api_internal::InternalFieldOutOfBounds
V8_EXPORT void InternalFieldOutOfBounds(int index)
v8
Definition
libplatform.h:15
v8::WeakCallbackType
WeakCallbackType
Definition
v8-weak-callback-info.h:65
v8::WeakCallbackType::kInternalFields
@ kInternalFields
Definition
v8-weak-callback-info.h:73
v8::WeakCallbackType::kParameter
@ kParameter
Definition
v8-weak-callback-info.h:69
v8config.h
V8_EXPORT
#define V8_EXPORT
Definition
v8config.h:800
V8_INLINE
#define V8_INLINE
Definition
v8config.h:500
include
v8-weak-callback-info.h
Generated on Fri May 30 2025 01:56:44 for v8 by
1.13.2