mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 06:09:08 +00:00
LibWeb: Make Platform::Timer GC-allocated
This will allow us to remove the use of SafeFunction in it's implementation. This requires a fair amount of plumbing to wire up the GC heap to the appropriate places in order to create the timers.
This commit is contained in:
parent
e44702f090
commit
ede3c91688
Notes:
github-actions[bot]
2024-10-30 19:57:28 +00:00
Author: https://github.com/shannonbooth
Commit: ede3c91688
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2062
Reviewed-by: https://github.com/kalenikaliaksandr ✅
15 changed files with 52 additions and 38 deletions
|
@ -28,6 +28,14 @@ ImageStyleValue::ImageStyleValue(URL::URL const& url)
|
|||
|
||||
ImageStyleValue::~ImageStyleValue() = default;
|
||||
|
||||
void ImageStyleValue::visit_edges(JS::Cell::Visitor& visitor) const
|
||||
{
|
||||
// FIXME: visit_edges in non-GC allocated classes is confusing pattern.
|
||||
// Consider making CSSStyleValue to be GC allocated instead.
|
||||
visitor.visit(m_resource_request);
|
||||
visitor.visit(m_timer);
|
||||
}
|
||||
|
||||
void ImageStyleValue::load_any_resources(DOM::Document& document)
|
||||
{
|
||||
if (m_resource_request)
|
||||
|
@ -53,7 +61,7 @@ void ImageStyleValue::load_any_resources(DOM::Document& document)
|
|||
|
||||
auto image_data = m_resource_request->image_data();
|
||||
if (image_data->is_animated() && image_data->frame_count() > 1) {
|
||||
m_timer = Platform::Timer::create();
|
||||
m_timer = Platform::Timer::create(m_document->heap());
|
||||
m_timer->set_interval(image_data->frame_duration(0));
|
||||
m_timer->on_timeout = [this] { animate(); };
|
||||
m_timer->start();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue