Everywhere: Hoist the Libraries folder to the top-level

This commit is contained in:
Timothy Flynn 2024-11-09 12:25:08 -05:00 committed by Andreas Kling
commit 93712b24bf
Notes: github-actions[bot] 2024-11-10 11:51:52 +00:00
4547 changed files with 104 additions and 113 deletions

View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 2021-2022, Idan Horowitz <idan.horowitz@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/SinglyLinkedList.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/JobCallback.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Value.h>
#include <LibJS/Runtime/WeakContainer.h>
namespace JS {
class FinalizationRegistry final
: public Object
, public WeakContainer {
JS_OBJECT(FinalizationRegistry, Object);
JS_DECLARE_ALLOCATOR(FinalizationRegistry);
public:
virtual ~FinalizationRegistry() override = default;
void add_finalization_record(Cell& target, Value held_value, Cell* unregister_token);
bool remove_by_token(Cell& unregister_token);
ThrowCompletionOr<void> cleanup(GCPtr<JobCallback> = {});
virtual void remove_dead_cells(Badge<Heap>) override;
Realm& realm() { return *m_realm; }
Realm const& realm() const { return *m_realm; }
JobCallback& cleanup_callback() { return *m_cleanup_callback; }
JobCallback const& cleanup_callback() const { return *m_cleanup_callback; }
private:
FinalizationRegistry(Realm&, NonnullGCPtr<JobCallback>, Object& prototype);
virtual void visit_edges(Visitor& visitor) override;
NonnullGCPtr<Realm> m_realm;
NonnullGCPtr<JobCallback> m_cleanup_callback;
struct FinalizationRecord {
GCPtr<Cell> target;
Value held_value;
GCPtr<Cell> unregister_token;
};
SinglyLinkedList<FinalizationRecord> m_records;
};
}