V8  latest master commit
V8 is Google's open source JavaScript engine
custom-space.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_CUSTOM_SPACE_H_
6 #define INCLUDE_CPPGC_CUSTOM_SPACE_H_
7 
8 #include <stddef.h>
9 
10 namespace cppgc {
11 
13  CustomSpaceIndex(size_t value) : value(value) {} // NOLINT
14  size_t value;
15 };
16 
22  public:
23  virtual ~CustomSpaceBase() = default;
24  virtual CustomSpaceIndex GetCustomSpaceIndex() const = 0;
25 };
26 
44 template <typename ConcreteCustomSpace>
45 class CustomSpace : public CustomSpaceBase {
46  public:
48  return ConcreteCustomSpace::kSpaceIndex;
49  }
50 };
51 
55 template <typename T, typename = void>
56 struct SpaceTrait {
57  using Space = void;
58 };
59 
60 } // namespace cppgc
61 
62 #endif // INCLUDE_CPPGC_CUSTOM_SPACE_H_
cppgc::SpaceTrait
Definition: custom-space.h:56
cppgc::CustomSpaceBase::GetCustomSpaceIndex
virtual CustomSpaceIndex GetCustomSpaceIndex() const =0
cppgc
Definition: allocation.h:18
cppgc::CustomSpaceIndex::value
size_t value
Definition: custom-space.h:14
cppgc::SpaceTrait::Space
void Space
Definition: custom-space.h:57
cppgc::CustomSpace::GetCustomSpaceIndex
CustomSpaceIndex GetCustomSpaceIndex() const final
Definition: custom-space.h:47
cppgc::CustomSpaceIndex
Definition: custom-space.h:12
cppgc::CustomSpaceBase::~CustomSpaceBase
virtual ~CustomSpaceBase()=default
cppgc::CustomSpaceBase
Definition: custom-space.h:21
cppgc::CustomSpace
Definition: custom-space.h:45
cppgc::CustomSpaceIndex::CustomSpaceIndex
CustomSpaceIndex(size_t value)
Definition: custom-space.h:13