Truly independent web browser
LibGC: Remove ActivityRoot
Shannon Booth6dceaad1d3e4
diff --git a/Documentation/WrapperArchitecture.md b/Documentation/WrapperArchitecture.mdindex 640cdb9e117..fbcc5349081 100644--- a/Documentation/WrapperArchitecture.md+++ b/Documentation/WrapperArchitecture.md@@ -119,10 +119,6 @@ Ordinary wrapper/implementation edges are:inline main-world representative;- implementation to preserved wrapper: strong, visited by `Wrappable`.-Pending activity is explicit. Objects such as timers, XHR, WebSocket, and-ResizeObserver take and release `GC::ActivityRoot`s at their state transitions-instead of relying on silent GC virtual predicates.-LibGC finalization clears wrapper cache entries before weak pointers areobserved as live again. Code that depends on weak wrapper caches relies on thatordering: wrapper finalization removes the cache entry, then weak references can@@ -182,8 +178,7 @@ Keep new wrapper work behind the narrow binding surface:Do not add ad-hoc implementation-pointer plumbing or new GC-specific livenessside channels outside that surface. When non-GC implementation objects arrive,the migration points are the generated implementation handle, weak-implementation-to-wrapper caches, preserved-wrapper roots, and the current-`ActivityRoot` model.+implementation-to-wrapper caches, and preserved-wrapper roots.## Testing wrapper and GC behavior (mandatory rules)diff --git a/Libraries/LibGC/ActivityRoot.h b/Libraries/LibGC/ActivityRoot.hdeleted file mode 100644index a9beff6b3d7..00000000000--- a/Libraries/LibGC/ActivityRoot.h+++ /dev/null@@ -1,46 +0,0 @@-/*- * Copyright (c) 2026-present, the Ladybird developers.- *- * SPDX-License-Identifier: BSD-2-Clause- */--#pragma once--#include <AK/Noncopyable.h>-#include <AK/SourceLocation.h>-#include <LibGC/Cell.h>-#include <LibGC/Root.h>--namespace GC {--class ActivityRoot {- AK_MAKE_NONCOPYABLE(ActivityRoot);- AK_MAKE_NONMOVABLE(ActivityRoot);--public:- ActivityRoot() = default;- ~ActivityRoot() { release(); }-- // ActivityRoot stores a normal GC root. The rooted cell must be the object- // that owns this ActivityRoot; rooting an unrelated cell can leave the root- // destructor touching freed storage if the owner dies first.- void take(Cell& cell, SourceLocation location = SourceLocation::current())- {- if (m_root.ptr() == &cell)- return;- m_root = Root<Cell>::create(&cell, location);- }-- void release()- {- m_root = {};- }-- bool is_taken() const { return !!m_root; }- Cell* cell() const { return m_root.ptr(); }--private:- Root<Cell> m_root;-};--}diff --git a/Tests/LibGC/TestGCContainers.cpp b/Tests/LibGC/TestGCContainers.cppindex e90132df6a0..6d058dedbc7 100644--- a/Tests/LibGC/TestGCContainers.cpp+++ b/Tests/LibGC/TestGCContainers.cpp@@ -5,7 +5,6 @@*/#include <AK/NeverDestroyed.h>-#include <LibGC/ActivityRoot.h>#include <LibGC/Cell.h>#include <LibGC/CellAllocator.h>#include <LibGC/ConservativeHashMap.h>@@ -156,28 +155,6 @@ TEST_CASE(root_vector_reports_roots)EXPECT_EQ(roots.size(), 1u);}-TEST_CASE(activity_root_controls_cell_liveness)-{- auto& heap = test_heap();- GC::ActivityRoot root;- GC::Weak<TestCell> weak_cell;-- {- auto cell = heap.allocate<TestCell>();- weak_cell = cell.ptr();- root.take(*cell);- }-- GC::scrub_stack_for_testing();- heap.collect_garbage();- EXPECT(weak_cell);-- root.release();- GC::scrub_stack_for_testing();- heap.collect_garbage(GC::Heap::CollectionType::CollectEverything);- EXPECT(!weak_cell);-}-TEST_CASE(root_vector_ptr_reports_roots){auto& heap = test_heap();