Bug 1885489 - Part 5: Add SnapshotIterator::readInt32(). r=iain
[gecko.git] / xpcom / threads / nsIIdleRunnable.h
blob7fe61491541703123cbab5d8786bcf25c2f01042
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 nsIIdleRunnable_h__
8 #define nsIIdleRunnable_h__
10 #include "nsISupports.h"
11 #include "mozilla/TimeStamp.h"
13 #define NS_IIDLERUNNABLE_IID \
14 { \
15 0x688be92e, 0x7ade, 0x4fdc, { \
16 0x9d, 0x83, 0x74, 0xcb, 0xef, 0xf4, 0xa5, 0x2c \
17 } \
20 class nsIEventTarget;
22 /**
23 * A task interface for tasks that can schedule their work to happen
24 * in increments bounded by a deadline.
26 class nsIIdleRunnable : public nsISupports {
27 public:
28 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIDLERUNNABLE_IID)
30 /**
31 * Notify the task of a point in time in the future when the task
32 * should stop executing.
34 virtual void SetDeadline(mozilla::TimeStamp aDeadline){};
35 virtual void SetTimer(uint32_t aDelay, nsIEventTarget* aTarget) {
36 MOZ_ASSERT_UNREACHABLE(
37 "The nsIIdleRunnable instance does not support "
38 "idle dispatch with timeout!");
41 protected:
42 nsIIdleRunnable() = default;
43 virtual ~nsIIdleRunnable() = default;
46 NS_DEFINE_STATIC_IID_ACCESSOR(nsIIdleRunnable, NS_IIDLERUNNABLE_IID)
48 #endif // nsIIdleRunnable_h__