Bug 1750871 - run mochitest-remote on fission everywhere. r=releng-reviewers,aki
[gecko.git] / dom / base / IdleRequest.h
blob2761da79f6d2fefc17fccd9f3ed567bda439b7e0
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_idlerequest_h
8 #define mozilla_dom_idlerequest_h
10 #include "mozilla/LinkedList.h"
11 #include "mozilla/Maybe.h"
12 #include "mozilla/RefPtr.h"
13 #include "nsCOMPtr.h"
14 #include "nsCycleCollectionParticipant.h"
15 #include "nsDOMNavigationTiming.h"
16 #include "nsICancelableRunnable.h"
17 #include "nsString.h"
19 class nsPIDOMWindowInner;
21 namespace mozilla {
22 namespace dom {
24 class IdleRequestCallback;
26 class IdleRequest final : public LinkedListElement<RefPtr<IdleRequest>> {
27 public:
28 IdleRequest(IdleRequestCallback* aCallback, uint32_t aHandle);
30 MOZ_CAN_RUN_SCRIPT
31 void IdleRun(nsPIDOMWindowInner* aWindow, DOMHighResTimeStamp aDeadline,
32 bool aDidTimeout);
34 void SetTimeoutHandle(int32_t aHandle);
35 bool HasTimeout() const { return mTimeoutHandle.isSome(); }
36 uint32_t GetTimeoutHandle() const;
38 uint32_t Handle() const { return mHandle; }
40 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(IdleRequest)
41 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(IdleRequest)
42 private:
43 ~IdleRequest();
45 RefPtr<IdleRequestCallback> mCallback;
46 const uint32_t mHandle;
47 mozilla::Maybe<int32_t> mTimeoutHandle;
50 } // namespace dom
51 } // namespace mozilla
53 #endif // mozilla_dom_idlerequest_h