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_IdleDeadline_h
8 #define mozilla_dom_IdleDeadline_h
10 #include "js/TypeDecls.h"
11 #include "mozilla/Attributes.h"
12 #include "mozilla/ErrorResult.h"
13 #include "mozilla/Maybe.h"
14 #include "mozilla/dom/BindingDeclarations.h"
16 #include "nsCycleCollectionParticipant.h"
17 #include "nsDOMNavigationTiming.h"
18 #include "nsWrapperCache.h"
20 class nsIGlobalObject
;
21 class nsPIDOMWindowInner
;
26 class IdleDeadline final
: public nsISupports
, public nsWrapperCache
{
28 IdleDeadline(nsPIDOMWindowInner
* aWindow
, bool aDidTimeout
,
29 DOMHighResTimeStamp aDeadline
);
31 IdleDeadline(nsIGlobalObject
* aGlobal
, bool aDidTimeout
,
32 DOMHighResTimeStamp aDeadline
);
34 nsIGlobalObject
* GetParentObject() const { return mGlobal
; }
36 virtual JSObject
* WrapObject(JSContext
* aCx
,
37 JS::Handle
<JSObject
*> aGivenProto
) override
;
39 DOMHighResTimeStamp
TimeRemaining();
40 bool DidTimeout() const;
42 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
43 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IdleDeadline
)
48 nsCOMPtr
<nsPIDOMWindowInner
> mWindow
;
49 nsCOMPtr
<nsIGlobalObject
> mGlobal
;
50 const bool mDidTimeout
;
51 const DOMHighResTimeStamp mDeadline
;
55 } // namespace mozilla
57 #endif // mozilla_dom_IdleDeadline_h