ladybird/Libraries/LibWeb/HTML/DecodedImageData.cpp

42 lines
840 B
C++
Raw Normal View History

/*
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/HTML/DecodedImageData.h>
namespace Web::HTML {
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);
}
DecodedImageData::DecodedImageData() = default;
DecodedImageData::~DecodedImageData() = default;
void DecodedImageData::notify_clients_did_update()
{
for (auto* client : m_clients)
client->decoded_image_data_did_update();
}
}