Bug 1885489 - Part 5: Add SnapshotIterator::readInt32(). r=iain
[gecko.git] / dom / webscheduling / WebTaskSchedulerWorker.h
blob173f95aa019e85b312db934ccff50cc94d4ba5d4
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 final : 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 void Disconnect() override;
39 private:
40 ~WebTaskSchedulerWorker() = default;
42 nsresult SetTimeoutForDelayedTask(WebTask* aTask, uint64_t aDelay) override;
43 bool DispatchEventLoopRunnable() override;
45 CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
47 } // namespace mozilla::dom
48 #endif