Files
ladybird/Libraries/LibDevTools/Actors/ProcessActor.cpp
Timothy Flynn 58bc44ba2a LibDevTools: Introduce a Firefox DevTools server library
To aid with debugging web page issues in Ladybird without needing to
implement a fully fledged inspector, we can implement the Firefox
DevTools protocol and use their DevTools. The protocol is described
here:

https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html

This commit contains just enough to connect to Ladybird from a DevTools
client.
2025-02-19 08:45:51 -05:00

46 lines
1.2 KiB
C++

/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/JsonObject.h>
#include <LibDevTools/Actors/ProcessActor.h>
namespace DevTools {
NonnullRefPtr<ProcessActor> ProcessActor::create(DevToolsServer& devtools, ByteString name, ProcessDescription description)
{
return adopt_ref(*new ProcessActor(devtools, move(name), move(description)));
}
ProcessActor::ProcessActor(DevToolsServer& devtools, ByteString name, ProcessDescription description)
: Actor(devtools, move(name))
, m_description(move(description))
{
}
ProcessActor::~ProcessActor() = default;
void ProcessActor::handle_message(StringView type, JsonObject const&)
{
send_unrecognized_packet_type_error(type);
}
JsonObject ProcessActor::serialize_description() const
{
JsonObject traits;
traits.set("watcher"sv, m_description.is_parent);
traits.set("supportsReloadDescriptor"sv, true);
JsonObject description;
description.set("actor"sv, name());
description.set("id"sv, m_description.id);
description.set("isParent"sv, m_description.is_parent);
description.set("isWindowlessParent"sv, m_description.is_windowless_parent);
description.set("traits"sv, move(traits));
return description;
}
}