summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/WorkerDebugConsoleClient.h
blob: 569ce5d4afec1d403a8cc9f0000ee29bba02933d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * 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

class WorkerDebugConsoleClient final
    : public JS::ConsoleClient
    , public RefCounted<WorkerDebugConsoleClient>
    , public Weakable<WorkerDebugConsoleClient> {
public:
    WorkerDebugConsoleClient(JS::Console& console);

    virtual void clear() override;
    virtual void end_group() override;
    virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments arguments) override;

private:
    int m_group_stack_depth { 0 };
};

} // namespace Web::HTML