#include "src/heap/cppgc/marking-visitor.h"
#include "include/cppgc/allocation.h"
#include "include/cppgc/member.h"
#include "include/cppgc/persistent.h"
#include "include/cppgc/source-location.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/heap-object-header.h"
#include "src/heap/cppgc/marker.h"
#include "src/heap/cppgc/marking-state.h"
#include "test/unittests/heap/cppgc/tests.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cppgc {
namespace internal {
namespace {
class MarkingVisitorTest : public testing::TestWithHeap { … };
class GCed : public GarbageCollected<GCed> { … };
class Mixin : public GarbageCollectedMixin { … };
class GCedWithMixin : public GarbageCollected<GCedWithMixin>, public Mixin { … };
class TestMarkingVisitor : public MutatorMarkingVisitor { … };
class TestRootMarkingVisitor : public RootMarkingVisitor { … };
}
TEST_F(MarkingVisitorTest, MarkedBytesAreInitiallyZero) { … }
TEST_F(MarkingVisitorTest, MarkMember) { … }
TEST_F(MarkingVisitorTest, MarkMemberMixin) { … }
TEST_F(MarkingVisitorTest, MarkPersistent) { … }
TEST_F(MarkingVisitorTest, MarkPersistentMixin) { … }
TEST_F(MarkingVisitorTest, DontMarkWeakMember) { … }
TEST_F(MarkingVisitorTest, DontMarkWeakMemberMixin) { … }
TEST_F(MarkingVisitorTest, DontMarkWeakPersistent) { … }
TEST_F(MarkingVisitorTest, DontMarkWeakPersistentMixin) { … }
namespace {
class GCedWithInConstructionCallback
: public GarbageCollected<GCedWithInConstructionCallback> { … };
class MixinWithInConstructionCallback : public GarbageCollectedMixin { … };
class GCedWithMixinWithInConstructionCallback
: public GarbageCollected<GCedWithMixinWithInConstructionCallback>,
public MixinWithInConstructionCallback { … };
}
TEST_F(MarkingVisitorTest, MarkMemberInConstruction) { … }
TEST_F(MarkingVisitorTest, MarkMemberMixinInConstruction) { … }
TEST_F(MarkingVisitorTest, DontMarkWeakMemberInConstruction) { … }
TEST_F(MarkingVisitorTest, DontMarkWeakMemberMixinInConstruction) { … }
TEST_F(MarkingVisitorTest, MarkPersistentInConstruction) { … }
TEST_F(MarkingVisitorTest, MarkPersistentMixinInConstruction) { … }
TEST_F(MarkingVisitorTest, StrongTracingMarksWeakMember) { … }
namespace {
struct GCedWithDestructor : GarbageCollected<GCedWithDestructor> { … };
size_t GCedWithDestructor::g_finalized = …;
struct GCedWithInConstructionCallbackWithMember : GCedWithDestructor { … };
struct ConservativeTracerTest : public testing::TestWithHeap { … };
}
TEST_F(ConservativeTracerTest, TraceConservativelyInConstructionObject) { … }
TEST_F(ConservativeTracerTest, TraceConservativelyStack) { … }
}
}