#include <atomic>
#include "include/cppgc/allocation.h"
#include "src/base/macros.h"
#include "src/heap/cppgc/marker.h"
#include "src/heap/cppgc/marking-visitor.h"
#include "src/heap/cppgc/stats-collector.h"
#include "test/unittests/heap/cppgc/tests.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cppgc {
namespace internal {
namespace {
class WeakContainerTest : public testing::TestWithHeap { … };
template <typename T>
constexpr size_t SizeOf() { … }
class TraceableGCed : public GarbageCollected<TraceableGCed> { … };
class NonTraceableGCed : public GarbageCollected<NonTraceableGCed> { … };
void EmptyWeakCallback(const LivenessBroker&, const void*) { … }
}
}
template <>
struct TraceTrait<internal::TraceableGCed>
: public internal::TraceTraitBase<internal::TraceableGCed> { … };
template <>
struct TraceTrait<internal::NonTraceableGCed>
: public internal::TraceTraitBase<internal::NonTraceableGCed> { … };
namespace internal {
TEST_F(WeakContainerTest, TraceableGCedTraced) { … }
TEST_F(WeakContainerTest, NonTraceableGCedNotTraced) { … }
TEST_F(WeakContainerTest, NonTraceableGCedNotTracedConservatively) { … }
TEST_F(WeakContainerTest, PreciseGCTracesWeakContainerWhenTraced) { … }
TEST_F(WeakContainerTest, ConservativeGCTracesWeakContainer) { … }
TEST_F(WeakContainerTest, ConservativeGCTracesWeakContainerOnce) { … }
namespace {
struct WeakCallback { … };
size_t WeakCallback::n_callback_called = …;
const void* WeakCallback::obj = …;
}
TEST_F(WeakContainerTest, WeakContainerWeakCallbackCalled) { … }
}
}