7#include "fxjs/gc/heap.h"
8#include "testing/fxgc_unittest.h"
9#include "testing/gtest/include/gtest/gtest.h"
10#include "v8/include/cppgc/member.h"
11#include "v8/include/cppgc/persistent.h"
15class HeapObject :
public cppgc::GarbageCollected<HeapObject> {
19 void Trace(cppgc::Visitor* visitor)
const {
20 visitor->Trace(frick_);
21 visitor->Trace(frack_);
24 cppgc::Member<HeapObject> frick_;
25 cppgc::Member<HeapObject> frack_;
28 HeapObject() =
default;
33 CppObject() =
default;
35 cppgc::Persistent<HeapObject> click_;
36 cppgc::Persistent<HeapObject> clack_;
46 cppgc::MakeGarbageCollected<HeapObject>(heap()->GetAllocationHandle());
48 obj->frack_ =
std::move(obj->frick_);
49 EXPECT_FALSE(obj->frick_);
50 EXPECT_EQ(obj, obj->frack_);
56 cppgc::MakeGarbageCollected<HeapObject>(heap()->GetAllocationHandle());
58 outsider.click_ = obj;
59 outsider.clack_ =
std::move(outsider.click_);
60 EXPECT_FALSE(outsider.click_);
61 EXPECT_EQ(obj, outsider.clack_);
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
TEST_F(MoveUnitTest, Member)