2025-02-15 07:57:36 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <AK/JsonArray.h>
|
|
|
|
#include <AK/JsonObject.h>
|
|
|
|
#include <LibDevTools/Actors/ThreadConfigurationActor.h>
|
|
|
|
|
|
|
|
namespace DevTools {
|
|
|
|
|
2025-02-19 09:28:02 -05:00
|
|
|
NonnullRefPtr<ThreadConfigurationActor> ThreadConfigurationActor::create(DevToolsServer& devtools, String name)
|
2025-02-15 07:57:36 -05:00
|
|
|
{
|
|
|
|
return adopt_ref(*new ThreadConfigurationActor(devtools, move(name)));
|
|
|
|
}
|
|
|
|
|
2025-02-19 09:28:02 -05:00
|
|
|
ThreadConfigurationActor::ThreadConfigurationActor(DevToolsServer& devtools, String name)
|
2025-02-15 07:57:36 -05:00
|
|
|
: Actor(devtools, move(name))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadConfigurationActor::~ThreadConfigurationActor() = default;
|
|
|
|
|
|
|
|
void ThreadConfigurationActor::handle_message(StringView type, JsonObject const& message)
|
|
|
|
{
|
|
|
|
JsonObject response;
|
|
|
|
|
|
|
|
if (type == "updateConfiguration"sv) {
|
|
|
|
auto configuration = message.get_object("configuration"sv);
|
|
|
|
if (!configuration.has_value()) {
|
|
|
|
send_missing_parameter_error("configuration"sv);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
send_message(move(response));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
send_unrecognized_packet_type_error(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
JsonObject ThreadConfigurationActor::serialize_configuration() const
|
|
|
|
{
|
|
|
|
JsonObject target;
|
|
|
|
target.set("actor"sv, name());
|
|
|
|
|
|
|
|
return target;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|