diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-04-19 13:35:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-19 13:35:14 +0200 |
commit | 493d7334f885bd4e79eedcba5037c7c4b65c8fc5 (patch) | |
tree | 69e364c791717f2b0bdf2994531a7b045f273542 /dom/base/IdleRequest.h | |
parent | d7df65954a585e97ccee21fa9cb50cb116efddcc (diff) | |
parent | b873b2495a4408c43368bbf5a5e1e8f9966e0593 (diff) | |
download | UXP-493d7334f885bd4e79eedcba5037c7c4b65c8fc5.tar UXP-493d7334f885bd4e79eedcba5037c7c4b65c8fc5.tar.gz UXP-493d7334f885bd4e79eedcba5037c7c4b65c8fc5.tar.lz UXP-493d7334f885bd4e79eedcba5037c7c4b65c8fc5.tar.xz UXP-493d7334f885bd4e79eedcba5037c7c4b65c8fc5.zip |
Merge pull request #207 from janekptacijarabaci/js_dom_window_requestIdleCallback_1
moebius#73: DOM - window.requestIdleCallback - improvements
Diffstat (limited to 'dom/base/IdleRequest.h')
-rw-r--r-- | dom/base/IdleRequest.h | 40 |
1 files changed, 11 insertions, 29 deletions
diff --git a/dom/base/IdleRequest.h b/dom/base/IdleRequest.h index cb234430a..acf56f852 100644 --- a/dom/base/IdleRequest.h +++ b/dom/base/IdleRequest.h @@ -12,7 +12,6 @@ #include "nsCOMPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsDOMNavigationTiming.h" -#include "nsITimeoutHandler.h" class nsPIDOMWindowInner; @@ -21,28 +20,19 @@ namespace dom { class IdleRequestCallback; -class IdleRequest final : public nsITimeoutHandler - , public nsIRunnable - , public nsICancelableRunnable - , public nsIIncrementalRunnable - , public LinkedListElement<IdleRequest> +class IdleRequest final : public nsISupports, + public LinkedListElement<IdleRequest> { public: - IdleRequest(JSContext* aCx, nsPIDOMWindowInner* aWindow, - IdleRequestCallback& aCallback, uint32_t aHandle); + IdleRequest(IdleRequestCallback* aCallback, uint32_t aHandle); - virtual nsresult Call() override; - virtual void GetLocation(const char** aFileName, uint32_t* aLineNo, - uint32_t* aColumn) override; - virtual void MarkForCC() override; + nsresult IdleRun(nsPIDOMWindowInner* aWindow, + DOMHighResTimeStamp aDeadline, + bool aDidTimeout); - nsresult SetTimeout(uint32_t aTimout); - nsresult RunIdleRequestCallback(bool aDidTimeout); - void CancelTimeout(); - - NS_DECL_NSIRUNNABLE; - virtual nsresult Cancel() override; - virtual void SetDeadline(mozilla::TimeStamp aDeadline) override; + void SetTimeoutHandle(int32_t aHandle); + bool HasTimeout() const { return mTimeoutHandle.isSome(); } + uint32_t GetTimeoutHandle() const; uint32_t Handle() const { @@ -50,22 +40,14 @@ public: } NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(IdleRequest, nsITimeoutHandler) + NS_DECL_CYCLE_COLLECTION_CLASS(IdleRequest) private: ~IdleRequest(); - // filename, line number and JS language version string of the - // caller of setTimeout() - nsCString mFileName; - uint32_t mLineNo; - uint32_t mColumn; - - nsCOMPtr<nsPIDOMWindowInner> mWindow; RefPtr<IdleRequestCallback> mCallback; - uint32_t mHandle; + const uint32_t mHandle; mozilla::Maybe<int32_t> mTimeoutHandle; - DOMHighResTimeStamp mDeadline; }; } // namespace dom |