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 nsICancelableRunnable_h__
8 #define nsICancelableRunnable_h__
10 #include "nsISupports.h"
12 #define NS_ICANCELABLERUNNABLE_IID \
14 0xde93dc4c, 0x5eea, 0x4eb7, { \
15 0xb6, 0xd1, 0xdb, 0xf1, 0xe0, 0xce, 0xf6, 0x5c \
19 class nsICancelableRunnable
: public nsISupports
{
21 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANCELABLERUNNABLE_IID
)
24 * Cancels a pending task, so that calling run() on the task is a no-op.
25 * Calling cancel after the task execution has begun will be a no-op.
26 * Calling this method twice is considered an error.
28 * @throws NS_ERROR_UNEXPECTED
29 * Indicates that the runnable has already been canceled.
31 virtual nsresult
Cancel() = 0;
34 nsICancelableRunnable() = default;
35 virtual ~nsICancelableRunnable() = default;
38 NS_DEFINE_STATIC_IID_ACCESSOR(nsICancelableRunnable
, NS_ICANCELABLERUNNABLE_IID
)
40 #endif // nsICancelableRunnable_h__