Bug 1843230 - Remove IsWin8OrLater checks from dom/geolocation/ r=emk
[gecko.git] / dom / ipc / VsyncWorkerChild.h
blobe34555936d684cacfb0a4a27fb8cbbc9557dea12
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_ipc_VsyncWorkerChild_h
8 #define mozilla_dom_ipc_VsyncWorkerChild_h
10 #include "mozilla/dom/VsyncChild.h"
11 #include "mozilla/RefPtr.h"
12 #include "nsISupportsImpl.h"
14 namespace mozilla::dom {
15 class DedicatedWorkerGlobalScope;
16 class IPCWorkerRef;
17 class WorkerPrivate;
19 // The PVsyncWorkerChild actor receives a vsync event from the main process and
20 // delivers it to the child process. This is specific for workers which wish to
21 // subscribe to vsync events to drive requestAnimationFrame callbacks.
22 class VsyncWorkerChild final : public VsyncChild {
23 NS_INLINE_DECL_REFCOUNTING(VsyncWorkerChild, override)
25 friend class PVsyncChild;
27 public:
28 VsyncWorkerChild();
30 bool Initialize(WorkerPrivate* aWorkerPrivate);
32 void Destroy();
34 void TryObserve();
36 void TryUnobserve();
38 private:
39 ~VsyncWorkerChild() override;
41 mozilla::ipc::IPCResult RecvNotify(const VsyncEvent& aVsync,
42 const float& aVsyncRate) override;
44 void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
46 RefPtr<IPCWorkerRef> mWorkerRef;
47 bool mObserving = false;
50 } // namespace mozilla::dom
52 #endif // mozilla_dom_ipc_VsyncWorkerChild_h