v8
9.4.146 (node 16.13.0)
V8 is Google's open source JavaScript engine
name-provider.h
Go to the documentation of this file.
1
// Copyright 2020 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_NAME_PROVIDER_H_
6
#
define
INCLUDE_CPPGC_NAME_PROVIDER_H_
7
8
#
include
"v8config.h"
// NOLINT(build/include_directory)
9
10
namespace
cppgc
{
11
12
/**
13
* NameProvider allows for providing a human-readable name for garbage-collected
14
* objects.
15
*
16
* There's two cases of names to distinguish:
17
* a. Explicitly specified names via using NameProvider. Such names are always
18
* preserved in the system.
19
* b. Internal names that Oilpan infers from a C++ type on the class hierarchy
20
* of the object. This is not necessarily the type of the actually
21
* instantiated object.
22
*
23
* Depending on the build configuration, Oilpan may hide names, i.e., represent
24
* them with kHiddenName, of case b. to avoid exposing internal details.
25
*/
26
class
V8_EXPORT
NameProvider
{
27
public
:
28
/**
29
* Name that is used when hiding internals.
30
*/
31
static
constexpr
const
char
kHiddenName
[] =
"InternalNode"
;
32
33
/**
34
* Name that is used in case compiler support is missing for composing a name
35
* from C++ types.
36
*/
37
static
constexpr
const
char
kNoNameDeducible
[] =
"<No name>"
;
38
39
/**
40
* Indicating whether internal names are hidden or not.
41
*
42
* @returns true if C++ names should be hidden and represented by kHiddenName.
43
*/
44
static
constexpr
bool
HideInternalNames
() {
45
#
if
CPPGC_SUPPORTS_OBJECT_NAMES
46
return
false
;
47
#
else
// !CPPGC_SUPPORTS_OBJECT_NAMES
48
return
true
;
49
#
endif
// !CPPGC_SUPPORTS_OBJECT_NAMES
50
}
51
52
virtual
~
NameProvider
() =
default
;
53
54
/**
55
* Specifies a name for the garbage-collected object. Such names will never
56
* be hidden, as they are explicitly specified by the user of this API.
57
*
58
* @returns a human readable name for the object.
59
*/
60
virtual
const
char
*
GetHumanReadableName
()
const
= 0;
61
};
62
63
}
// namespace cppgc
64
65
#
endif
// INCLUDE_CPPGC_NAME_PROVIDER_H_
include
cppgc
name-provider.h
Generated on Fri Oct 29 2021 20:27:46 for v8 by
1.9.1