Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / base / IdleDeadline.h
blob2ce06e489d55d307189ea3662ba8e5b80cfdb8a4
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/Maybe.h"
13 #include "mozilla/dom/BindingDeclarations.h"
14 #include "nsCOMPtr.h"
15 #include "nsCycleCollectionParticipant.h"
16 #include "nsDOMNavigationTiming.h"
17 #include "nsWrapperCache.h"
19 class nsIGlobalObject;
20 class nsPIDOMWindowInner;
22 namespace mozilla::dom {
24 class IdleDeadline final : public nsISupports, public nsWrapperCache {
25 public:
26 IdleDeadline(nsPIDOMWindowInner* aWindow, bool aDidTimeout,
27 DOMHighResTimeStamp aDeadline);
29 IdleDeadline(nsIGlobalObject* aGlobal, bool aDidTimeout,
30 DOMHighResTimeStamp aDeadline);
32 nsIGlobalObject* GetParentObject() const { return mGlobal; }
34 virtual JSObject* WrapObject(JSContext* aCx,
35 JS::Handle<JSObject*> aGivenProto) override;
37 DOMHighResTimeStamp TimeRemaining();
38 bool DidTimeout() const;
40 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
41 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(IdleDeadline)
43 private:
44 ~IdleDeadline();
46 nsCOMPtr<nsPIDOMWindowInner> mWindow;
47 nsCOMPtr<nsIGlobalObject> mGlobal;
48 const bool mDidTimeout;
49 const DOMHighResTimeStamp mDeadline;
52 } // namespace mozilla::dom
54 #endif // mozilla_dom_IdleDeadline_h