Bug 1812499 [wpt PR 38184] - Simplify handling of name-to-subdir mapping in canvas...
[gecko.git] / dom / base / IdleRequest.h
blob533284b7ef7e4e8c63b92eade4a3163dea10c5e2
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::dom {
23 class IdleRequestCallback;
25 class IdleRequest final : public LinkedListElement<RefPtr<IdleRequest>> {
26 public:
27 IdleRequest(IdleRequestCallback* aCallback, uint32_t aHandle);
29 MOZ_CAN_RUN_SCRIPT
30 void IdleRun(nsPIDOMWindowInner* aWindow, DOMHighResTimeStamp aDeadline,
31 bool aDidTimeout);
33 void SetTimeoutHandle(int32_t aHandle);
34 bool HasTimeout() const { return mTimeoutHandle.isSome(); }
35 uint32_t GetTimeoutHandle() const;
37 uint32_t Handle() const { return mHandle; }
39 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(IdleRequest)
40 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(IdleRequest)
41 private:
42 ~IdleRequest();
44 RefPtr<IdleRequestCallback> mCallback;
45 const uint32_t mHandle;
46 mozilla::Maybe<int32_t> mTimeoutHandle;
49 } // namespace mozilla::dom
51 #endif // mozilla_dom_idlerequest_h