2022-02-17 15:31:09 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Ben Abraham <ben.d.abraham@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/RefCounted.h>
|
|
|
|
#include <AK/Weakable.h>
|
|
|
|
#include <LibJS/Console.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
// NOTE: Temporary class to handle console messages from inside Workers
|
|
|
|
|
2024-05-02 11:24:23 +03:00
|
|
|
class WorkerDebugConsoleClient final : public JS::ConsoleClient {
|
2024-04-20 22:19:51 +03:00
|
|
|
JS_CELL(WorkerDebugConsoleClient, JS::ConsoleClient);
|
|
|
|
JS_DECLARE_ALLOCATOR(WorkerDebugConsoleClient);
|
2022-02-17 15:31:09 +03:00
|
|
|
|
2024-04-20 22:19:51 +03:00
|
|
|
public:
|
2022-02-17 15:31:09 +03:00
|
|
|
virtual void clear() override;
|
|
|
|
virtual void end_group() override;
|
|
|
|
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments arguments) override;
|
|
|
|
|
|
|
|
private:
|
2024-04-20 22:19:51 +03:00
|
|
|
WorkerDebugConsoleClient(JS::Console& console);
|
|
|
|
|
2022-02-17 15:31:09 +03:00
|
|
|
int m_group_stack_depth { 0 };
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Web::HTML
|