summaryrefslogtreecommitdiffstats
path: root/dom/base/IdleRequest.h
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-19 13:35:14 +0200
committerGitHub <noreply@github.com>2018-04-19 13:35:14 +0200
commit493d7334f885bd4e79eedcba5037c7c4b65c8fc5 (patch)
tree69e364c791717f2b0bdf2994531a7b045f273542 /dom/base/IdleRequest.h
parentd7df65954a585e97ccee21fa9cb50cb116efddcc (diff)
parentb873b2495a4408c43368bbf5a5e1e8f9966e0593 (diff)
downloadUXP-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.h40
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