diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-20 10:46:27 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-20 10:56:31 +0100 |
commit | e017fe92e6be10a3793232f43973373baf443914 (patch) | |
tree | 7e04cd70145477a1a31113a3e3415a63ad57d3f6 /Userland/Libraries/LibWeb/ImageDecoding.cpp | |
parent | b224efe73bf2a47330163368afb90931280ef0b9 (diff) | |
download | serenity-e017fe92e6be10a3793232f43973373baf443914.zip |
LibWeb: Move ImageDecoder client connection singleton to its own file
This will allow us to use it in more places around LibWeb.
Diffstat (limited to 'Userland/Libraries/LibWeb/ImageDecoding.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/ImageDecoding.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/ImageDecoding.cpp b/Userland/Libraries/LibWeb/ImageDecoding.cpp new file mode 100644 index 0000000000..706c04c97a --- /dev/null +++ b/Userland/Libraries/LibWeb/ImageDecoding.cpp @@ -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; +} + +} |