Bug 1874684 - Part 28: Return DateDuration from DifferenceISODateTime. r=mgaudet
[gecko.git] / gfx / vr / VRThread.h
blob85d9ea4b84114607ce5b98aeca4bba0b09f90d1b
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 GFX_VR_THREAD_H
8 #define GFX_VR_THREAD_H
10 #include "nsISupportsImpl.h"
11 #include "base/thread.h" // for Thread
13 namespace mozilla {
14 namespace gfx {
16 class VRThread final {
17 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRThread)
19 public:
20 explicit VRThread(const nsCString& aName);
22 void Start();
23 void Shutdown();
24 void SetLifeTime(uint32_t aLifeTime);
25 uint32_t GetLifeTime();
26 void CheckLife(TimeStamp aCheckTimestamp);
27 void PostTask(already_AddRefed<Runnable> aTask);
28 void PostDelayedTask(already_AddRefed<Runnable> aTask, uint32_t aTime);
29 const nsCOMPtr<nsIThread> GetThread() const;
30 bool IsActive();
32 protected:
33 ~VRThread();
35 private:
36 nsCOMPtr<nsIThread> mThread;
37 TimeStamp mLastActiveTime;
38 nsCString mName;
39 uint32_t mLifeTime;
40 Atomic<bool> mStarted;
43 } // namespace gfx
44 } // namespace mozilla
46 #endif // GFX_VR_THREAD_H