mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
This is to prepare for an upcoming change where we will need to track replies to messages by ID. We will be able to add parameters to this structure without having to edit every single actor subclass header file.
50 lines
1.2 KiB
C++
50 lines
1.2 KiB
C++
/*
|
|
* 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 {
|
|
|
|
NonnullRefPtr<ThreadConfigurationActor> ThreadConfigurationActor::create(DevToolsServer& devtools, String name)
|
|
{
|
|
return adopt_ref(*new ThreadConfigurationActor(devtools, move(name)));
|
|
}
|
|
|
|
ThreadConfigurationActor::ThreadConfigurationActor(DevToolsServer& devtools, String name)
|
|
: Actor(devtools, move(name))
|
|
{
|
|
}
|
|
|
|
ThreadConfigurationActor::~ThreadConfigurationActor() = default;
|
|
|
|
void ThreadConfigurationActor::handle_message(Message const& message)
|
|
{
|
|
JsonObject response;
|
|
|
|
if (message.type == "updateConfiguration"sv) {
|
|
auto configuration = get_required_parameter<JsonObject>(message, "configuration"sv);
|
|
if (!configuration.has_value())
|
|
return;
|
|
|
|
send_message(move(response));
|
|
return;
|
|
}
|
|
|
|
send_unrecognized_packet_type_error(message);
|
|
}
|
|
|
|
JsonObject ThreadConfigurationActor::serialize_configuration() const
|
|
{
|
|
JsonObject target;
|
|
target.set("actor"sv, name());
|
|
|
|
return target;
|
|
}
|
|
|
|
}
|