LibJS+LibWeb: Make Console, ConsoleClient & subclasses GC-allocated

These objects had confusing ownership semantics. Let's just throw them
all on the GC heap and stop worrying about it.
This commit is contained in:
Andreas Kling
2024-04-20 21:19:51 +02:00
parent 44659f2f2a
commit 4db1712f90
13 changed files with 95 additions and 34 deletions

View File

@@ -16,16 +16,18 @@ namespace Web::HTML {
class WorkerDebugConsoleClient final
: public JS::ConsoleClient
, public RefCounted<WorkerDebugConsoleClient>
, public Weakable<WorkerDebugConsoleClient> {
public:
WorkerDebugConsoleClient(JS::Console& console);
JS_CELL(WorkerDebugConsoleClient, JS::ConsoleClient);
JS_DECLARE_ALLOCATOR(WorkerDebugConsoleClient);
public:
virtual void clear() override;
virtual void end_group() override;
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments arguments) override;
private:
WorkerDebugConsoleClient(JS::Console& console);
int m_group_stack_depth { 0 };
};