Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
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/. */
6 :
7 : #ifndef mozilla_dom_IdleDeadline_h
8 : #define mozilla_dom_IdleDeadline_h
9 :
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"
15 : #include "nsCOMPtr.h"
16 : #include "nsCycleCollectionParticipant.h"
17 : #include "nsDOMNavigationTiming.h"
18 : #include "nsWrapperCache.h"
19 :
20 : class nsPIDOMWindowInner;
21 :
22 : namespace mozilla {
23 : namespace dom {
24 :
25 : class IdleDeadline final
26 : : public nsISupports
27 : , public nsWrapperCache
28 : {
29 : public:
30 : IdleDeadline(nsPIDOMWindowInner* aWindow, bool aDidTimeout,
31 : DOMHighResTimeStamp aDeadline);
32 :
33 1 : nsPIDOMWindowInner* GetParentObject() const { return mWindow; }
34 :
35 : virtual JSObject* WrapObject(JSContext* aCx,
36 : JS::Handle<JSObject*> aGivenProto) override;
37 :
38 : DOMHighResTimeStamp TimeRemaining();
39 : bool DidTimeout() const;
40 :
41 : NS_DECL_CYCLE_COLLECTING_ISUPPORTS
42 19 : NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IdleDeadline)
43 :
44 : private:
45 : ~IdleDeadline();
46 :
47 : nsCOMPtr<nsPIDOMWindowInner> mWindow;
48 : const bool mDidTimeout;
49 : const DOMHighResTimeStamp mDeadline;
50 : };
51 :
52 : } // namespace dom
53 : } // namespace mozilla
54 :
55 : #endif // mozilla_dom_IdleDeadline_h
|