1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibWeb: Implement the infrastructure necessary for requestIdleCallback

This includes a bug fix for the event loop processing steps which has
not been merged yet: https://github.com/whatwg/html/pull/7768
This commit is contained in:
Simon Wanner 2022-03-31 21:55:01 +02:00 committed by Linus Groh
parent 73da139cd7
commit 836d2ff259
6 changed files with 209 additions and 31 deletions

View file

@ -55,6 +55,8 @@ public:
NonnullRefPtrVector<DOM::Document> documents_in_this_event_loop() const;
NonnullRefPtrVector<Window> same_loop_windows() const;
void push_onto_backup_incumbent_settings_object_stack(Badge<EnvironmentSettingsObject>, EnvironmentSettingsObject& environment_settings_object);
void pop_backup_incumbent_settings_object_stack(Badge<EnvironmentSettingsObject>);
EnvironmentSettingsObject& top_of_backup_incumbent_settings_object_stack();
@ -63,6 +65,9 @@ public:
void register_environment_settings_object(Badge<EnvironmentSettingsObject>, EnvironmentSettingsObject&);
void unregister_environment_settings_object(Badge<EnvironmentSettingsObject>, EnvironmentSettingsObject&);
double unsafe_shared_current_time() const;
double compute_deadline() const;
private:
Type m_type { Type::Window };
@ -72,6 +77,11 @@ private:
// https://html.spec.whatwg.org/multipage/webappapis.html#currently-running-task
Task* m_currently_running_task { nullptr };
// https://html.spec.whatwg.org/multipage/webappapis.html#last-render-opportunity-time
double m_last_render_opportunity_time { 0 };
// https://html.spec.whatwg.org/multipage/webappapis.html#last-idle-period-start-time
double m_last_idle_period_start_time { 0 };
JS::VM* m_vm { nullptr };
RefPtr<Core::Timer> m_system_event_loop_timer;