1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

LibWeb+LibImageDecoderClient: Reuse ImageDecoder service process

The overhead from spawning a new ImageDecoder for every decoding job is
way too large and causing other problems as well (#5421)

Let's keep the same decoder open and reuse it as long as it's working.
This commit is contained in:
Andreas Kling 2021-02-20 11:35:00 +01:00
parent 8fb9d1fd1d
commit 3b9f110161
3 changed files with 26 additions and 3 deletions

View file

@ -35,6 +35,12 @@ Client::Client()
handshake();
}
void Client::die()
{
if (on_death)
on_death();
}
void Client::handshake()
{
send_sync<Messages::ImageDecoderServer::Greet>();

View file

@ -44,7 +44,7 @@ struct DecodedImage {
Vector<Frame> frames;
};
class Client
class Client final
: public IPC::ServerConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>
, public ImageDecoderClientEndpoint {
C_OBJECT(Client);
@ -54,9 +54,13 @@ public:
Optional<DecodedImage> decode_image(const ByteBuffer&);
Function<void()> on_death;
private:
Client();
virtual void die() override;
virtual void handle(const Messages::ImageDecoderClient::Dummy&) override;
};