1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:37:35 +00:00

LibJS+Userland: Port the JS Console object and direct callers to String

This commit is contained in:
Timothy Flynn 2023-02-10 11:40:52 -05:00 committed by Linus Groh
parent 8f9659a549
commit 3b4879d29b
5 changed files with 125 additions and 84 deletions

View file

@ -10,6 +10,7 @@
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/Noncopyable.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibCore/ElapsedTimer.h>
#include <LibJS/Forward.h>
@ -45,12 +46,12 @@ public:
};
struct Group {
DeprecatedString label;
String label;
};
struct Trace {
DeprecatedString label;
Vector<DeprecatedString> stack;
String label;
Vector<String> stack;
};
explicit Console(Realm&);
@ -61,8 +62,8 @@ public:
MarkedVector<Value> vm_arguments();
HashMap<DeprecatedString, unsigned>& counters() { return m_counters; }
HashMap<DeprecatedString, unsigned> const& counters() const { return m_counters; }
HashMap<String, unsigned>& counters() { return m_counters; }
HashMap<String, unsigned> const& counters() const { return m_counters; }
ThrowCompletionOr<Value> debug();
ThrowCompletionOr<Value> error();
@ -81,18 +82,18 @@ public:
ThrowCompletionOr<Value> time_log();
ThrowCompletionOr<Value> time_end();
void output_debug_message(LogLevel log_level, DeprecatedString const& output) const;
void output_debug_message(LogLevel log_level, String const& output) const;
void report_exception(JS::Error const&, bool) const;
private:
ThrowCompletionOr<DeprecatedString> value_vector_to_deprecated_string(MarkedVector<Value> const&);
ThrowCompletionOr<DeprecatedString> format_time_since(Core::ElapsedTimer timer);
ThrowCompletionOr<String> value_vector_to_string(MarkedVector<Value> const&);
ThrowCompletionOr<String> format_time_since(Core::ElapsedTimer timer);
Realm& m_realm;
ConsoleClient* m_client { nullptr };
HashMap<DeprecatedString, unsigned> m_counters;
HashMap<DeprecatedString, Core::ElapsedTimer> m_timer_table;
HashMap<String, unsigned> m_counters;
HashMap<String, Core::ElapsedTimer> m_timer_table;
Vector<Group> m_group_stack;
};