LibWeb: Make BackingStore atomic ref-counted
Some checks are pending
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This is required to make sure rendering thread will keep backing stores
alive in case backing stores reallocation happens during rasterization.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/4164
This commit is contained in:
Aliaksandr Kalenik 2025-04-01 01:44:35 +02:00 committed by Alexander Kalenik
commit e33174fca1
Notes: github-actions[bot] 2025-04-01 01:06:13 +00:00
6 changed files with 28 additions and 17 deletions

View file

@ -205,16 +205,16 @@ void PageClient::process_screenshot_requests()
}
auto rect = page().enclosing_device_rect(dom_node->paintable_box()->absolute_border_box_rect());
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, rect.size().to_type<int>()).release_value_but_fixme_should_propagate_errors();
auto backing_store = Web::Painting::BitmapBackingStore(*bitmap);
start_display_list_rendering(rect, backing_store, { .paint_overlay = Web::PaintOptions::PaintOverlay::No }, [this, bitmap] {
client().async_did_take_screenshot(m_id, bitmap->to_shareable_bitmap());
auto backing_store = Web::Painting::BitmapBackingStore::create(*bitmap);
start_display_list_rendering(rect, backing_store, { .paint_overlay = Web::PaintOptions::PaintOverlay::No }, [this, backing_store] {
client().async_did_take_screenshot(m_id, backing_store->bitmap().to_shareable_bitmap());
});
} else {
Web::DevicePixelRect rect { { 0, 0 }, content_size() };
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, rect.size().to_type<int>()).release_value_but_fixme_should_propagate_errors();
auto backing_store = Web::Painting::BitmapBackingStore(*bitmap);
start_display_list_rendering(rect, backing_store, {}, [this, bitmap] {
client().async_did_take_screenshot(m_id, bitmap->to_shareable_bitmap());
auto backing_store = Web::Painting::BitmapBackingStore::create(*bitmap);
start_display_list_rendering(rect, backing_store, {}, [this, backing_store] {
client().async_did_take_screenshot(m_id, backing_store->bitmap().to_shareable_bitmap());
});
}
}