diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2021-09-04 12:12:12 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 18:20:26 +0200 |
commit | 703bd4c9da6a5dac204c202fa9cddb6c38a2fc62 (patch) | |
tree | f4f2ff6d05b4b0ab641cb8df7ab61b989c0a82f1 /Userland/Applications/Browser/ConsoleWidget.h | |
parent | f6a927fa20723feb7c9bbb10d83bf7f220477a06 (diff) | |
download | serenity-703bd4c9da6a5dac204c202fa9cddb6c38a2fc62.zip |
Browser: Convert JS ConsoleWidget to new API
The console widget now requests messages and receives them in bulk,
using the shiny new IPC calls. This lets it display console messages
that occurred before the widget was created. :^)
Diffstat (limited to 'Userland/Applications/Browser/ConsoleWidget.h')
-rw-r--r-- | Userland/Applications/Browser/ConsoleWidget.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Userland/Applications/Browser/ConsoleWidget.h b/Userland/Applications/Browser/ConsoleWidget.h index 0610865aa7..23276bea94 100644 --- a/Userland/Applications/Browser/ConsoleWidget.h +++ b/Userland/Applications/Browser/ConsoleWidget.h @@ -1,6 +1,7 @@ /* * Copyright (c) 2020, Hunter Salyer <thefalsehonesty@gmail.com> * Copyright (c) 2021, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -18,18 +19,27 @@ class ConsoleWidget final : public GUI::Widget { public: virtual ~ConsoleWidget(); - void handle_js_console_output(const String& method, const String& line); + void notify_about_new_console_message(i32 message_index); + void handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages); void print_source_line(const StringView&); void print_html(const StringView&); - void clear_output(); + void reset(); Function<void(const String&)> on_js_input; + Function<void(i32)> on_request_messages; private: ConsoleWidget(); + void request_console_messages(); + void clear_output(); + RefPtr<GUI::TextBox> m_input; RefPtr<Web::OutOfProcessWebView> m_output_view; + + i32 m_highest_notified_message_index { -1 }; + i32 m_highest_received_message_index { -1 }; + bool m_waiting_for_messages { false }; }; } |