1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

LibWeb: Change HTML::Timer to store its owning window as a JS::Object

Rather than being limited to a Window object, it will also need to be
ownable by a WorkerGlobalScope.
This commit is contained in:
Timothy Flynn 2023-03-14 06:55:34 -04:00 committed by Tim Flynn
parent ea11a84332
commit b579093ad0
2 changed files with 9 additions and 8 deletions

View file

@ -20,18 +20,18 @@ class Timer final : public JS::Cell {
JS_CELL(Timer, JS::Cell);
public:
static JS::NonnullGCPtr<Timer> create(Window&, i32 milliseconds, Function<void()> callback, i32 id);
static JS::NonnullGCPtr<Timer> create(JS::Object&, i32 milliseconds, Function<void()> callback, i32 id);
virtual ~Timer() override;
void start();
private:
Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id);
Timer(JS::Object& window, i32 milliseconds, Function<void()> callback, i32 id);
virtual void visit_edges(Cell::Visitor&) override;
RefPtr<Platform::Timer> m_timer;
JS::NonnullGCPtr<Window> m_window;
JS::NonnullGCPtr<JS::Object> m_window_or_worker_global_scope;
Function<void()> m_callback;
i32 m_id { 0 };
};