2025-02-25 00:07:53 -03:00
|
|
|
/*
|
2026-01-26 08:59:43 -03:00
|
|
|
* Copyright (c) 2025-2026, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
2025-02-25 00:07:53 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Noncopyable.h>
|
2026-04-05 12:00:40 -03:00
|
|
|
#include <AK/NonnullRefPtr.h>
|
2025-02-25 00:07:53 -03:00
|
|
|
#include <AK/Queue.h>
|
2026-04-05 12:00:40 -03:00
|
|
|
#include <AK/Variant.h>
|
2025-02-25 00:07:53 -03:00
|
|
|
#include <LibThreading/ConditionVariable.h>
|
2025-09-17 17:45:03 -03:00
|
|
|
#include <LibThreading/Forward.h>
|
2025-02-25 00:07:53 -03:00
|
|
|
#include <LibThreading/Mutex.h>
|
2025-04-03 13:03:17 -03:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
#include <LibWeb/Page/Page.h>
|
2025-02-25 00:07:53 -03:00
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
|
|
class RenderingThread {
|
|
|
|
|
AK_MAKE_NONCOPYABLE(RenderingThread);
|
|
|
|
|
AK_MAKE_NONMOVABLE(RenderingThread);
|
|
|
|
|
|
2026-01-26 08:59:43 -03:00
|
|
|
class ThreadData;
|
|
|
|
|
|
2025-02-25 00:07:53 -03:00
|
|
|
public:
|
2026-01-26 11:53:29 -03:00
|
|
|
using PresentationCallback = Function<void(Gfx::IntRect const&, i32)>;
|
2026-04-05 12:00:40 -03:00
|
|
|
struct PresentToUI {
|
|
|
|
|
};
|
|
|
|
|
struct PublishToExternalContent {
|
|
|
|
|
NonnullRefPtr<Painting::ExternalContentSource> source;
|
|
|
|
|
};
|
|
|
|
|
using PresentationMode = Variant<PresentToUI, PublishToExternalContent>;
|
2026-01-26 11:53:29 -03:00
|
|
|
|
|
|
|
|
explicit RenderingThread(PresentationCallback);
|
2025-02-25 00:07:53 -03:00
|
|
|
~RenderingThread();
|
|
|
|
|
|
2025-04-03 13:03:17 -03:00
|
|
|
void start(DisplayListPlayerType);
|
2025-07-10 14:24:30 -03:00
|
|
|
void set_skia_player(OwnPtr<Painting::DisplayListPlayerSkia>&& player);
|
2026-04-05 12:00:40 -03:00
|
|
|
void set_presentation_mode(PresentationMode);
|
2025-02-25 00:07:53 -03:00
|
|
|
|
2026-04-05 12:32:54 -03:00
|
|
|
void update_display_list(NonnullRefPtr<Painting::DisplayList>, Painting::ScrollStateSnapshot&&);
|
2026-01-26 08:59:43 -03:00
|
|
|
void update_backing_stores(RefPtr<Gfx::PaintingSurface> front, RefPtr<Gfx::PaintingSurface> back, i32 front_id, i32 back_id);
|
2026-04-05 12:00:40 -03:00
|
|
|
u64 present_frame(Gfx::IntRect);
|
|
|
|
|
void wait_for_frame(u64 frame_id);
|
2026-01-26 08:59:43 -03:00
|
|
|
void request_screenshot(NonnullRefPtr<Gfx::PaintingSurface>, Function<void()>&& callback);
|
2025-02-25 00:07:53 -03:00
|
|
|
|
2026-01-26 13:47:49 -03:00
|
|
|
void ready_to_paint();
|
|
|
|
|
|
2026-01-26 08:59:43 -03:00
|
|
|
private:
|
|
|
|
|
NonnullRefPtr<ThreadData> m_thread_data;
|
2025-02-25 00:07:53 -03:00
|
|
|
RefPtr<Threading::Thread> m_thread;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|