mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 12:07:14 +02:00
Previously, iframes were rasterized synchronously as nested display lists inside their parent's display list: the parent's paint walk called record_display_list() on each hosted iframe document and emitted a PaintNestedDisplayList command that the player would recurse into. Only the top-level traversable's RenderingThread was ever active, even though every Navigable already owned one. The motivation for splitting this apart: - Work in the outer document no longer has to be re-recorded when only an iframe changes. The parent's cached display list now references the iframe's rasterized output live via an ExternalContentSource, so an iframe invalidation just needs the parent's display list replayed, not re-recorded. - Each iframe now has a self-contained rasterization pipeline, which is prep work for moving iframes into separate sandboxed processes.
57 lines
1.6 KiB
C++
57 lines
1.6 KiB
C++
/*
|
|
* Copyright (c) 2025-2026, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Noncopyable.h>
|
|
#include <AK/NonnullRefPtr.h>
|
|
#include <AK/Queue.h>
|
|
#include <AK/Variant.h>
|
|
#include <LibThreading/ConditionVariable.h>
|
|
#include <LibThreading/Forward.h>
|
|
#include <LibThreading/Mutex.h>
|
|
#include <LibWeb/Forward.h>
|
|
#include <LibWeb/Page/Page.h>
|
|
|
|
namespace Web::HTML {
|
|
|
|
class RenderingThread {
|
|
AK_MAKE_NONCOPYABLE(RenderingThread);
|
|
AK_MAKE_NONMOVABLE(RenderingThread);
|
|
|
|
class ThreadData;
|
|
|
|
public:
|
|
using PresentationCallback = Function<void(Gfx::IntRect const&, i32)>;
|
|
struct PresentToUI {
|
|
};
|
|
struct PublishToExternalContent {
|
|
NonnullRefPtr<Painting::ExternalContentSource> source;
|
|
};
|
|
using PresentationMode = Variant<PresentToUI, PublishToExternalContent>;
|
|
|
|
explicit RenderingThread(PresentationCallback);
|
|
~RenderingThread();
|
|
|
|
void start(DisplayListPlayerType);
|
|
void set_skia_player(OwnPtr<Painting::DisplayListPlayerSkia>&& player);
|
|
void set_presentation_mode(PresentationMode);
|
|
|
|
void update_display_list(NonnullRefPtr<Painting::DisplayList>, Painting::ScrollStateSnapshotByDisplayList&&);
|
|
void update_backing_stores(RefPtr<Gfx::PaintingSurface> front, RefPtr<Gfx::PaintingSurface> back, i32 front_id, i32 back_id);
|
|
u64 present_frame(Gfx::IntRect);
|
|
void wait_for_frame(u64 frame_id);
|
|
void request_screenshot(NonnullRefPtr<Gfx::PaintingSurface>, Function<void()>&& callback);
|
|
|
|
void ready_to_paint();
|
|
|
|
private:
|
|
NonnullRefPtr<ThreadData> m_thread_data;
|
|
RefPtr<Threading::Thread> m_thread;
|
|
};
|
|
|
|
}
|