Bug 1771337 [wpt PR 34217] - Convert `popup=popup` to `popup=auto` or just `popup...
[gecko.git] / dom / webscheduling / WebTaskSchedulerWorker.h
blob4af987736ea5e1324a3566eee54a1326bd2b82c1
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef mozilla_dom_WebTaskSchedulerWorker_h
9 #define mozilla_dom_WebTaskSchedulerWorker_h
11 #include "WebTaskScheduler.h"
13 #include "mozilla/LinkedList.h"
14 #include "mozilla/dom/WorkerRunnable.h"
15 #include "mozilla/dom/WorkerPrivate.h"
16 #include "mozilla/dom/WebTaskSchedulingBinding.h"
18 namespace mozilla::dom {
20 class WebTaskWorkerRunnable : public WorkerSameThreadRunnable {
21 public:
22 WebTaskWorkerRunnable(WorkerPrivate* aWorkerPrivate,
23 WebTaskSchedulerWorker* aSchedulerWorker);
25 MOZ_CAN_RUN_SCRIPT_BOUNDARY
26 bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override;
28 private:
29 ~WebTaskWorkerRunnable() = default;
30 WeakPtr<WebTaskSchedulerWorker> mSchedulerWorker;
33 class WebTaskSchedulerWorker final : public WebTaskScheduler {
34 public:
35 explicit WebTaskSchedulerWorker(WorkerPrivate* aWorkerPrivate);
37 private:
38 ~WebTaskSchedulerWorker() = default;
40 nsresult SetTimeoutForDelayedTask(WebTask* aTask, uint64_t aDelay) override;
41 bool DispatchEventLoopRunnable() override;
43 CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
45 } // namespace mozilla::dom
46 #endif