2025-02-25 04:07:53 +01:00
|
|
|
/*
|
2026-01-26 12:59:43 +01:00
|
|
|
* Copyright (c) 2025-2026, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
2025-02-25 04:07:53 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Noncopyable.h>
|
|
|
|
|
#include <AK/Queue.h>
|
2025-04-28 17:59:55 -06:00
|
|
|
#include <LibCore/Promise.h>
|
2025-02-25 04:07:53 +01:00
|
|
|
#include <LibThreading/ConditionVariable.h>
|
2025-09-17 15:45:03 -05:00
|
|
|
#include <LibThreading/Forward.h>
|
2025-02-25 04:07:53 +01:00
|
|
|
#include <LibThreading/Mutex.h>
|
2025-04-03 18:03:17 +02:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
#include <LibWeb/Page/Page.h>
|
2025-02-25 04:07:53 +01:00
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
|
|
class RenderingThread {
|
|
|
|
|
AK_MAKE_NONCOPYABLE(RenderingThread);
|
|
|
|
|
AK_MAKE_NONMOVABLE(RenderingThread);
|
|
|
|
|
|
2026-01-26 12:59:43 +01:00
|
|
|
class ThreadData;
|
|
|
|
|
|
2025-02-25 04:07:53 +01:00
|
|
|
public:
|
2026-01-26 15:53:29 +01:00
|
|
|
using PresentationCallback = Function<void(Gfx::IntRect const&, i32)>;
|
|
|
|
|
|
|
|
|
|
explicit RenderingThread(PresentationCallback);
|
2025-02-25 04:07:53 +01:00
|
|
|
~RenderingThread();
|
|
|
|
|
|
2025-04-03 18:03:17 +02:00
|
|
|
void start(DisplayListPlayerType);
|
2025-07-10 19:24:30 +02:00
|
|
|
void set_skia_player(OwnPtr<Painting::DisplayListPlayerSkia>&& player);
|
2025-02-25 04:07:53 +01:00
|
|
|
|
2026-01-26 12:59:43 +01:00
|
|
|
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);
|
2026-01-26 15:53:29 +01:00
|
|
|
void present_frame(Gfx::IntRect);
|
2026-01-26 12:59:43 +01:00
|
|
|
void request_screenshot(NonnullRefPtr<Gfx::PaintingSurface>, Function<void()>&& callback);
|
2025-02-25 04:07:53 +01:00
|
|
|
|
2026-01-26 17:47:49 +01:00
|
|
|
void ready_to_paint();
|
|
|
|
|
|
2026-01-26 12:59:43 +01:00
|
|
|
private:
|
|
|
|
|
NonnullRefPtr<ThreadData> m_thread_data;
|
2025-02-25 04:07:53 +01:00
|
|
|
RefPtr<Threading::Thread> m_thread;
|
2025-04-28 17:59:55 -06:00
|
|
|
NonnullRefPtr<Core::Promise<NonnullRefPtr<Core::EventReceiver>>> m_main_thread_exit_promise;
|
2025-02-25 04:07:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|