v8
13.6.233 (node 24.1.0)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
explicit-management.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_CPPGC_EXPLICIT_MANAGEMENT_H_
6
#define INCLUDE_CPPGC_EXPLICIT_MANAGEMENT_H_
7
8
#include <cstddef>
9
10
#include "
cppgc/allocation.h
"
11
#include "
cppgc/internal/logging.h
"
12
#include "
cppgc/type-traits.h
"
13
14
namespace
cppgc
{
15
16
class
HeapHandle
;
17
18
namespace
subtle
{
19
20
template
<
typename
T>
21
void
FreeUnreferencedObject
(HeapHandle& heap_handle, T&
object
);
22
template
<
typename
T>
23
bool
Resize
(T&
object
, AdditionalBytes additional_bytes);
24
25
}
// namespace subtle
26
27
namespace
internal
{
28
29
class
ExplicitManagementImpl
final {
30
private
:
31
V8_EXPORT
static
void
FreeUnreferencedObject(
HeapHandle
&,
void
*);
32
V8_EXPORT
static
bool
Resize(
void
*,
size_t
);
33
34
template
<
typename
T>
35
friend
void
subtle::FreeUnreferencedObject
(
HeapHandle
&, T&);
36
template
<
typename
T>
37
friend
bool
subtle::Resize
(T&,
AdditionalBytes
);
38
};
39
}
// namespace internal
40
41
namespace
subtle
{
42
60
template
<
typename
T>
61
void
FreeUnreferencedObject
(
HeapHandle
& heap_handle, T&
object
) {
62
static_assert
(
IsGarbageCollectedTypeV<T>
,
63
"Object must be of type GarbageCollected."
);
64
internal::ExplicitManagementImpl::FreeUnreferencedObject(heap_handle,
65
&
object
);
66
}
67
89
template
<
typename
T>
90
bool
Resize
(T&
object
,
AdditionalBytes
additional_bytes) {
91
static_assert
(
IsGarbageCollectedTypeV<T>
,
92
"Object must be of type GarbageCollected."
);
93
return
internal::ExplicitManagementImpl::Resize(
94
&
object
,
sizeof
(T) + additional_bytes.
value
);
95
}
96
97
}
// namespace subtle
98
}
// namespace cppgc
99
100
#endif
// INCLUDE_CPPGC_EXPLICIT_MANAGEMENT_H_
allocation.h
cppgc::HeapHandle
Definition
heap-handle.h:21
cppgc::internal::ExplicitManagementImpl
Definition
explicit-management.h:29
logging.h
cppgc::internal
Definition
allocation.h:45
cppgc::subtle
Definition
cross-thread-persistent.h:431
cppgc::subtle::Resize
bool Resize(T &object, AdditionalBytes additional_bytes)
Definition
explicit-management.h:90
cppgc::subtle::FreeUnreferencedObject
void FreeUnreferencedObject(HeapHandle &heap_handle, T &object)
Definition
explicit-management.h:61
cppgc
Definition
allocation.h:38
cppgc::IsGarbageCollectedTypeV
constexpr bool IsGarbageCollectedTypeV
Definition
type-traits.h:207
cppgc::AdditionalBytes
Definition
allocation.h:218
cppgc::AdditionalBytes::value
const size_t value
Definition
allocation.h:220
type-traits.h
V8_EXPORT
#define V8_EXPORT
Definition
v8config.h:800
include
cppgc
explicit-management.h
Generated on Fri May 30 2025 01:56:44 for v8 by
1.13.2