mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-21 15:14:13 +00:00
LibWeb: Move ImageDecoder client connection singleton to its own file
This will allow us to use it in more places around LibWeb.
This commit is contained in:
23
Userland/Libraries/LibWeb/ImageDecoding.cpp
Normal file
23
Userland/Libraries/LibWeb/ImageDecoding.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/ImageDecoding.h>
|
||||
|
||||
namespace Web {
|
||||
|
||||
ImageDecoderClient::Client& image_decoder_client()
|
||||
{
|
||||
static RefPtr<ImageDecoderClient::Client> image_decoder_client;
|
||||
if (!image_decoder_client) {
|
||||
image_decoder_client = ImageDecoderClient::Client::construct();
|
||||
image_decoder_client->on_death = [&] {
|
||||
image_decoder_client = nullptr;
|
||||
};
|
||||
}
|
||||
return *image_decoder_client;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user