LibGfx+LibWeb: Move Skia backend context to process level singleton

Previously, this was attached to the traversable navigable. Using a
singleton instead allows us to use the context for detached documents.
This commit is contained in:
Tim Ledbetter
2026-03-16 23:55:40 +00:00
committed by Jelle Raaijmakers
parent d4cf537d58
commit 26389363ad
Notes: github-actions[bot] 2026-03-19 12:36:24 +00:00
18 changed files with 90 additions and 77 deletions

View File

@@ -15,6 +15,7 @@
#include <LibCrypto/OpenSSLForward.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/PathFontProvider.h>
#include <LibGfx/SkiaBackendContext.h>
#include <LibIPC/ConnectionFromClient.h>
#include <LibIPC/TransportHandle.h>
#include <LibJS/Bytecode/Interpreter.h>
@@ -198,7 +199,12 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
Web::set_browser_process_executable_path(executable_path);
// Always use the CPU backend for tests, as the GPU backend is not deterministic
WebContent::PageClient::set_use_skia_painter(force_cpu_painting ? WebContent::PageClient::UseSkiaPainter::CPUBackend : WebContent::PageClient::UseSkiaPainter::GPUBackendIfAvailable);
if (force_cpu_painting) {
WebContent::PageClient::set_use_skia_painter(WebContent::PageClient::UseSkiaPainter::CPUBackend);
} else {
Gfx::SkiaBackendContext::initialize_gpu_backend();
WebContent::PageClient::set_use_skia_painter(WebContent::PageClient::UseSkiaPainter::GPUBackendIfAvailable);
}
WebContent::PageClient::set_is_headless(is_headless);