#include "include/cppgc/allocation.h"
#include "include/cppgc/custom-space.h"
#include "src/heap/cppgc/heap-page.h"
#include "src/heap/cppgc/raw-heap.h"
#include "test/unittests/heap/cppgc/tests.h"
namespace cppgc {
class CustomSpace1 : public CustomSpace<CustomSpace1> { … };
class CustomSpace2 : public CustomSpace<CustomSpace2> { … };
namespace internal {
namespace {
size_t g_destructor_callcount;
class TestWithHeapWithCustomSpaces : public testing::TestWithPlatform { … };
class RegularGCed final : public GarbageCollected<RegularGCed> { … };
class CustomGCed1 final : public GarbageCollected<CustomGCed1> { … };
class CustomGCed2 final : public GarbageCollected<CustomGCed2> { … };
class CustomGCedBase : public GarbageCollected<CustomGCedBase> { … };
class CustomGCedFinal1 final : public CustomGCedBase { … };
class CustomGCedFinal2 final : public CustomGCedBase { … };
constexpr size_t kDoubleWord = …;
class alignas(kDoubleWord) CustomGCedWithDoubleWordAlignment final
: public GarbageCollected<CustomGCedWithDoubleWordAlignment> { … };
}
}
template <>
struct SpaceTrait<internal::CustomGCed1> { … };
template <>
struct SpaceTrait<internal::CustomGCed2> { … };
SpaceTrait<T, std::enable_if_t<std::is_base_of<internal::CustomGCedBase, T>::value>>;
template <>
struct SpaceTrait<internal::CustomGCedWithDoubleWordAlignment> { … };
namespace internal {
TEST_F(TestWithHeapWithCustomSpaces, AllocateOnCustomSpaces) { … }
TEST_F(TestWithHeapWithCustomSpaces, AllocateDoubleWordAlignedOnCustomSpace) { … }
TEST_F(TestWithHeapWithCustomSpaces, DifferentSpacesUsesDifferentPages) { … }
TEST_F(TestWithHeapWithCustomSpaces,
AllocateOnCustomSpacesSpecifiedThroughBase) { … }
TEST_F(TestWithHeapWithCustomSpaces, SweepCustomSpace) { … }
}
class CompactableCustomSpace : public CustomSpace<CompactableCustomSpace> { … };
class NotCompactableCustomSpace
: public CustomSpace<NotCompactableCustomSpace> { … };
class DefaultCompactableCustomSpace
: public CustomSpace<DefaultCompactableCustomSpace> { … };
namespace internal {
namespace {
class TestWithHeapWithCompactableCustomSpaces
: public testing::TestWithPlatform { … };
class CompactableGCed final : public GarbageCollected<CompactableGCed> { … };
class NotCompactableGCed final : public GarbageCollected<NotCompactableGCed> { … };
class DefaultCompactableGCed final
: public GarbageCollected<DefaultCompactableGCed> { … };
}
}
template <>
struct SpaceTrait<internal::CompactableGCed> { … };
template <>
struct SpaceTrait<internal::NotCompactableGCed> { … };
template <>
struct SpaceTrait<internal::DefaultCompactableGCed> { … };
namespace internal {
TEST_F(TestWithHeapWithCompactableCustomSpaces,
AllocateOnCompactableCustomSpaces) { … }
}
}