chromium/v8/test/unittests/heap/cppgc/concurrent-marking-unittest.cc

// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "include/cppgc/allocation.h"
#include "include/cppgc/default-platform.h"
#include "include/cppgc/member.h"
#include "include/cppgc/persistent.h"
#include "src/heap/cppgc/globals.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 ConcurrentMarkingTest : public testing::TestWithHeap {};

template <typename T>
struct GCedHolder : public GarbageCollected<GCedHolder<T>> {};

class GCed : public GarbageCollected<GCed> {};

class GCedWithCallback : public GarbageCollected<GCedWithCallback> {};

class Mixin : public GarbageCollectedMixin {};

class GCedWithMixin : public GarbageCollected<GCedWithMixin>, public Mixin {};

}  // namespace

// The following tests below check for data races during concurrent marking.

TEST_F(ConcurrentMarkingTest, MarkingObjects) {}

TEST_F(ConcurrentMarkingTest, MarkingInConstructionObjects) {}

TEST_F(ConcurrentMarkingTest, MarkingMixinObjects) {}

namespace {

struct ConcurrentlyTraceable : public GarbageCollected<ConcurrentlyTraceable> {};
size_t ConcurrentlyTraceable::trace_counter =;

struct NotConcurrentlyTraceable
    : public GarbageCollected<NotConcurrentlyTraceable> {};
size_t NotConcurrentlyTraceable::trace_counter =;

}  // namespace

TEST_F(ConcurrentMarkingTest, ConcurrentlyTraceableObjectIsTracedConcurrently) {}

TEST_F(ConcurrentMarkingTest,
       NotConcurrentlyTraceableObjectIsNotTracedConcurrently) {}

}  // namespace internal
}  // namespace cppgc