2023-05-10 14:36:43 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
2023-05-10 14:36:43 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/HTML/DecodedImageData.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
2026-06-14 07:04:42 -03:00
|
|
|
void DecodedImageData::Client::register_with_decoded_image_data_if_needed()
|
|
|
|
|
{
|
|
|
|
|
auto const& image_data = decoded_image_data();
|
|
|
|
|
|
|
|
|
|
if (!image_data)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
image_data->m_clients.set(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DecodedImageData::Client::unregister_with_decoded_image_data_if_needed()
|
|
|
|
|
{
|
|
|
|
|
auto const& image_data = decoded_image_data();
|
|
|
|
|
|
|
|
|
|
if (!image_data)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
image_data->m_clients.remove(this);
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-20 11:11:36 -03:00
|
|
|
DecodedImageData::DecodedImageData() = default;
|
2023-05-10 14:36:43 -03:00
|
|
|
|
|
|
|
|
DecodedImageData::~DecodedImageData() = default;
|
|
|
|
|
|
2026-06-14 07:04:42 -03:00
|
|
|
void DecodedImageData::notify_clients_did_update()
|
|
|
|
|
{
|
|
|
|
|
for (auto* client : m_clients)
|
|
|
|
|
client->decoded_image_data_did_update();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-10 14:36:43 -03:00
|
|
|
}
|