mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-26 11:18:59 +00:00
LibIPC: Add an on_destruction hook to IPC::Message
Any cleanup of resources needed (up until the message is sent) can be done here. Currently, the only such resource is an IPC::File.
This commit is contained in:
parent
b03e8a6d06
commit
bdd4b99d72
Notes:
sideshowbarker
2024-07-19 00:21:42 +09:00
Author: https://github.com/alimpfard
Commit: bdd4b99d72
Pull-request: https://github.com/SerenityOS/serenity/pull/4665
2 changed files with 5 additions and 0 deletions
|
@ -34,6 +34,8 @@ Message::Message()
|
||||||
|
|
||||||
Message::~Message()
|
Message::~Message()
|
||||||
{
|
{
|
||||||
|
if (on_destruction)
|
||||||
|
on_destruction();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/Function.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
@ -44,6 +45,8 @@ public:
|
||||||
virtual const char* message_name() const = 0;
|
virtual const char* message_name() const = 0;
|
||||||
virtual MessageBuffer encode() const = 0;
|
virtual MessageBuffer encode() const = 0;
|
||||||
|
|
||||||
|
Function<void()> on_destruction;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Message();
|
Message();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue