1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 13:45:06 +00:00

IPCCompiler: Put message classes in the Messages namespace

This commit is contained in:
Andreas Kling 2020-02-06 20:20:44 +01:00
parent 0709c17487
commit 2e219255a2
26 changed files with 321 additions and 319 deletions

View file

@ -38,18 +38,18 @@ Client::Client()
void Client::handshake()
{
auto response = send_sync<ProtocolServer::Greet>();
auto response = send_sync<Messages::ProtocolServer::Greet>();
set_my_client_id(response->client_id());
}
bool Client::is_supported_protocol(const String& protocol)
{
return send_sync<ProtocolServer::IsSupportedProtocol>(protocol)->supported();
return send_sync<Messages::ProtocolServer::IsSupportedProtocol>(protocol)->supported();
}
RefPtr<Download> Client::start_download(const String& url)
{
i32 download_id = send_sync<ProtocolServer::StartDownload>(url)->download_id();
i32 download_id = send_sync<Messages::ProtocolServer::StartDownload>(url)->download_id();
auto download = Download::create_from_id({}, *this, download_id);
m_downloads.set(download_id, download);
return download;
@ -59,20 +59,20 @@ bool Client::stop_download(Badge<Download>, Download& download)
{
if (!m_downloads.contains(download.id()))
return false;
return send_sync<ProtocolServer::StopDownload>(download.id())->success();
return send_sync<Messages::ProtocolServer::StopDownload>(download.id())->success();
}
void Client::handle(const ProtocolClient::DownloadFinished& message)
void Client::handle(const Messages::ProtocolClient::DownloadFinished& message)
{
RefPtr<Download> download;
if ((download = m_downloads.get(message.download_id()).value_or(nullptr))) {
download->did_finish({}, message.success(), message.total_size(), message.shared_buffer_id());
}
send_sync<ProtocolServer::DisownSharedBuffer>(message.shared_buffer_id());
send_sync<Messages::ProtocolServer::DisownSharedBuffer>(message.shared_buffer_id());
m_downloads.remove(message.download_id());
}
void Client::handle(const ProtocolClient::DownloadProgress& message)
void Client::handle(const Messages::ProtocolClient::DownloadProgress& message)
{
if (auto download = m_downloads.get(message.download_id()).value_or(nullptr)) {
download->did_progress({}, message.total_size(), message.downloaded_size());