mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 13:30:31 +00:00
Userland: Remove serialize-to-JSON functions only used for Inspector
This commit is contained in:
parent
c756e021a7
commit
3de8dd921e
Notes:
sideshowbarker
2024-07-17 03:03:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3de8dd921e Pull-request: https://github.com/SerenityOS/serenity/pull/18493 Reviewed-by: https://github.com/FireFox317
8 changed files with 0 additions and 112 deletions
|
@ -174,14 +174,6 @@ void Object::deferred_invoke(Function<void()> invokee)
|
|||
Core::deferred_invoke([invokee = move(invokee), strong_this = NonnullRefPtr(*this)] { invokee(); });
|
||||
}
|
||||
|
||||
void Object::save_to(JsonObject& json)
|
||||
{
|
||||
for (auto& it : m_properties) {
|
||||
auto& property = it.value;
|
||||
json.set(property->name(), property->get());
|
||||
}
|
||||
}
|
||||
|
||||
JsonValue Object::property(DeprecatedString const& name) const
|
||||
{
|
||||
auto it = m_properties.find(name);
|
||||
|
|
|
@ -157,8 +157,6 @@ public:
|
|||
|
||||
void deferred_invoke(Function<void()>);
|
||||
|
||||
void save_to(JsonObject&);
|
||||
|
||||
bool set_property(DeprecatedString const& name, JsonValue const& value);
|
||||
JsonValue property(DeprecatedString const& name) const;
|
||||
HashMap<DeprecatedString, NonnullOwnPtr<Property>> const& properties() const { return m_properties; }
|
||||
|
|
|
@ -767,24 +767,6 @@ auto Editor::get_line(DeprecatedString const& prompt) -> Result<DeprecatedString
|
|||
return m_input_error.has_value() ? Result<DeprecatedString, Editor::Error> { m_input_error.value() } : Result<DeprecatedString, Editor::Error> { m_returned_line };
|
||||
}
|
||||
|
||||
void Editor::save_to(JsonObject& object)
|
||||
{
|
||||
Core::Object::save_to(object);
|
||||
object.set("is_searching", m_is_searching);
|
||||
object.set("is_editing", m_is_editing);
|
||||
object.set("cursor_offset", m_cursor);
|
||||
object.set("needs_refresh", m_refresh_needed);
|
||||
object.set("unprocessed_characters", m_incomplete_data.size());
|
||||
object.set("history_size", m_history.size());
|
||||
object.set("current_prompt", m_new_prompt);
|
||||
object.set("was_interrupted", m_was_interrupted);
|
||||
JsonObject display_area;
|
||||
display_area.set("top_left_row", m_origin_row);
|
||||
display_area.set("top_left_column", m_origin_column);
|
||||
display_area.set("line_count", num_lines());
|
||||
object.set("used_display_area", move(display_area));
|
||||
}
|
||||
|
||||
ErrorOr<void> Editor::try_update_once()
|
||||
{
|
||||
if (m_was_interrupted) {
|
||||
|
|
|
@ -266,9 +266,6 @@ private:
|
|||
Retry
|
||||
};
|
||||
|
||||
// FIXME: Port to Core::Property
|
||||
void save_to(JsonObject&);
|
||||
|
||||
ErrorOr<void> try_update_once();
|
||||
void handle_interrupt_event();
|
||||
ErrorOr<void> handle_read_event();
|
||||
|
|
|
@ -346,56 +346,6 @@ ErrorOr<NonnullRefPtr<Service>> Service::try_create(Core::ConfigFile const& conf
|
|||
return service;
|
||||
}
|
||||
|
||||
void Service::save_to(JsonObject& json)
|
||||
{
|
||||
Core::Object::save_to(json);
|
||||
|
||||
json.set("executable_path", m_executable_path);
|
||||
|
||||
// FIXME: This crashes Inspector.
|
||||
/*
|
||||
JsonArray extra_args;
|
||||
for (String& arg : m_extra_arguments)
|
||||
extra_args.append(arg);
|
||||
json.set("extra_arguments", move(extra_args));
|
||||
|
||||
JsonArray system_modes;
|
||||
for (String& mode : m_system_modes)
|
||||
system_modes.append(mode);
|
||||
json.set("system_modes", system_modes);
|
||||
|
||||
JsonArray environment;
|
||||
for (String& env : m_environment)
|
||||
system_modes.append(env);
|
||||
json.set("environment", environment);
|
||||
|
||||
JsonArray sockets;
|
||||
for (SocketDescriptor &socket : m_sockets) {
|
||||
JsonObject socket_obj;
|
||||
socket_obj.set("path", socket.path);
|
||||
socket_obj.set("permissions", socket.permissions);
|
||||
sockets.append(socket);
|
||||
}
|
||||
json.set("sockets", sockets);
|
||||
*/
|
||||
|
||||
json.set("stdio_file_path", m_stdio_file_path);
|
||||
json.set("priority", m_priority);
|
||||
json.set("keep_alive", m_keep_alive);
|
||||
json.set("lazy", m_lazy);
|
||||
json.set("user", m_user);
|
||||
json.set("multi_instance", m_multi_instance);
|
||||
json.set("accept_socket_connections", m_accept_socket_connections);
|
||||
|
||||
if (m_pid > 0)
|
||||
json.set("pid", m_pid);
|
||||
else
|
||||
json.set("pid", nullptr);
|
||||
|
||||
json.set("restart_attempts", m_restart_attempts);
|
||||
json.set("working_directory", m_working_directory);
|
||||
}
|
||||
|
||||
bool Service::is_enabled() const
|
||||
{
|
||||
extern DeprecatedString g_system_mode;
|
||||
|
|
|
@ -26,9 +26,6 @@ public:
|
|||
|
||||
static Service* find_by_pid(pid_t);
|
||||
|
||||
// FIXME: Port to Core::Property
|
||||
void save_to(JsonObject&);
|
||||
|
||||
private:
|
||||
Service(Core::ConfigFile const&, StringView name);
|
||||
|
||||
|
|
|
@ -2348,32 +2348,6 @@ void Shell::kill_job(Job const* job, int sig)
|
|||
}
|
||||
}
|
||||
|
||||
ErrorOr<void> Shell::save_to(JsonObject& object)
|
||||
{
|
||||
Core::Object::save_to(object);
|
||||
object.set("working_directory", cwd);
|
||||
object.set("username", username);
|
||||
object.set("user_home_path", home);
|
||||
object.set("user_id", uid);
|
||||
object.set("directory_stack_size", directory_stack.size());
|
||||
object.set("cd_history_size", cd_history.size());
|
||||
|
||||
// Jobs.
|
||||
JsonArray job_objects;
|
||||
for (auto& job_entry : jobs) {
|
||||
JsonObject job_object;
|
||||
job_object.set("pid", job_entry.value->pid());
|
||||
job_object.set("pgid", job_entry.value->pgid());
|
||||
job_object.set("running_time", job_entry.value->timer().elapsed());
|
||||
job_object.set("command", job_entry.value->cmd());
|
||||
job_object.set("is_running_in_background", job_entry.value->is_running_in_background());
|
||||
TRY(job_objects.append(move(job_object)));
|
||||
}
|
||||
object.set("jobs", move(job_objects));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void Shell::possibly_print_error() const
|
||||
{
|
||||
switch (m_error) {
|
||||
|
|
|
@ -401,8 +401,6 @@ private:
|
|||
|
||||
bool is_allowed_to_modify_termios(const AST::Command&) const;
|
||||
|
||||
// FIXME: Port to Core::Property
|
||||
ErrorOr<void> save_to(JsonObject&);
|
||||
void bring_cursor_to_beginning_of_a_line() const;
|
||||
|
||||
Optional<int> resolve_job_spec(StringView);
|
||||
|
|
Loading…
Reference in a new issue