#include <vector>
#include "include/cppgc/allocation.h"
#include "include/cppgc/cross-thread-persistent.h"
#include "include/cppgc/garbage-collected.h"
#include "include/cppgc/internal/persistent-node.h"
#include "include/cppgc/internal/pointer-policies.h"
#include "include/cppgc/member.h"
#include "include/cppgc/persistent.h"
#include "include/cppgc/source-location.h"
#include "include/cppgc/type-traits.h"
#include "src/base/logging.h"
#include "src/base/platform/platform.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/heap.h"
#include "src/heap/cppgc/liveness-broker.h"
#include "src/heap/cppgc/visitor.h"
#include "test/unittests/heap/cppgc/tests.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cppgc {
namespace internal {
namespace {
struct GCed : GarbageCollected<GCed> { … };
size_t GCed::trace_call_count = …;
struct DerivedGCed : GCed { … };
template <template <typename> class PersistentType>
struct PersistentRegionTrait;
template <>
struct PersistentRegionTrait<Persistent> { … };
template <>
struct PersistentRegionTrait<WeakPersistent> { … };
template <>
struct PersistentRegionTrait<subtle::CrossThreadPersistent> { … };
template <>
struct PersistentRegionTrait<subtle::WeakCrossThreadPersistent> { … };
template <template <typename> class PersistentType>
auto& GetRegion(cppgc::Heap* heap) { … }
LocalizedPersistent;
LocalizedCrossThreadPersistent;
class TestRootVisitor final : public RootVisitorBase { … };
class PersistentTest : public testing::TestWithHeap { … };
class PersistentDeathTest : public testing::TestWithHeap { … };
}
template <template <typename> class PersistentType>
void NullStateCtor(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, NullStateCtor) { … }
template <template <typename> class PersistentType>
void RawCtor(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, RawCtor) { … }
template <template <typename> class PersistentType>
void CopyCtor(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, CopyCtor) { … }
template <template <typename> class PersistentType>
void MoveCtor(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, MoveCtor) { … }
template <template <typename> class PersistentType,
template <typename> class MemberType>
void MemberCtor(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, MemberCtor) { … }
template <template <typename> class PersistentType>
void NullStateAssignment(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, NullStateAssignment) { … }
template <template <typename> class PersistentType>
void RawAssignment(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, RawAssignment) { … }
template <template <typename> class PersistentType>
void CopyAssignment(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, CopyAssignment) { … }
template <template <typename> class PersistentType>
void MoveAssignment(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, MoveAssignment) { … }
template <template <typename> class PersistentType,
template <typename> class MemberType>
void MemberAssignment(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, MemberAssignment) { … }
template <template <typename> class PersistentType>
void ClearTest(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, Clear) { … }
template <template <typename> class PersistentType>
void ReleaseTest(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, Release) { … }
template <template <typename> class PersistentType1,
template <typename> class PersistentType2>
void HeterogeneousConversion(cppgc::Heap* heap) { … }
TEST_F(PersistentTest, HeterogeneousConversion) { … }
namespace {
class Parent : public GarbageCollected<Parent> { … };
class Child : public Parent { … };
template <template <typename> class PersistentType>
void ImplicitUpcast(cppgc::Heap* heap) { … }
template <template <typename> class PersistentType>
void ExplicitDowncast(cppgc::Heap* heap) { … }
}
TEST_F(PersistentTest, ImplicitUpcast) { … }
TEST_F(PersistentTest, ExplicitDowncast) { … }
namespace {
template <template <typename> class PersistentType1,
template <typename> class PersistentType2>
void EqualityTest(cppgc::Heap* heap) { … }
}
TEST_F(PersistentTest, EqualityTest) { … }
TEST_F(PersistentTest, TraceStrong) { … }
TEST_F(PersistentTest, TraceWeak) { … }
TEST_F(PersistentTest, ClearOnHeapDestruction) { … }
#if V8_SUPPORTS_SOURCE_LOCATION
TEST_F(PersistentTest, LocalizedPersistent) { … }
#endif
namespace {
class ExpectingLocationVisitor final : public RootVisitorBase { … };
}
TEST_F(PersistentTest, PersistentTraceLocation) { … }
namespace {
class IncompleteType;
}
TEST_F(PersistentTest, EmptyPersistentConstructDestructWithoutCompleteType) { … }
TEST_F(PersistentTest, Lock) { … }
namespace {
class TraceCounter final : public GarbageCollected<TraceCounter> { … };
class DestructionCounter final : public GarbageCollected<DestructionCounter> { … };
size_t DestructionCounter::destructor_calls_;
}
TEST_F(PersistentTest, PersistentRetainsObject) { … }
TEST_F(PersistentTest, WeakPersistentDoesNotRetainObject) { … }
TEST_F(PersistentTest, ObjectReclaimedAfterClearedPersistent) { … }
namespace {
class PersistentAccessOnBackgroundThread : public v8::base::Thread { … };
}
TEST_F(PersistentDeathTest, CheckCreationThread) { … }
}
}