Line data Source code
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/. */
6 :
7 : #ifndef nsICancelableRunnable_h__
8 : #define nsICancelableRunnable_h__
9 :
10 : #include "nsISupports.h"
11 :
12 : #define NS_ICANCELABLERUNNABLE_IID \
13 : { 0xde93dc4c, 0x5eea, 0x4eb7, \
14 : { 0xb6, 0xd1, 0xdb, 0xf1, 0xe0, 0xce, 0xf6, 0x5c } }
15 :
16 : class nsICancelableRunnable : public nsISupports
17 : {
18 : public:
19 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANCELABLERUNNABLE_IID)
20 :
21 : /*
22 : * Cancels a pending task. If the task has already been executed this will
23 : * be a no-op. Calling this method twice is considered an error.
24 : *
25 : * @throws NS_ERROR_UNEXPECTED
26 : * Indicates that the runnable has already been canceled.
27 : */
28 : virtual nsresult Cancel() = 0;
29 :
30 : protected:
31 1692 : nsICancelableRunnable() { }
32 1548 : virtual ~nsICancelableRunnable() {}
33 : };
34 :
35 : NS_DEFINE_STATIC_IID_ACCESSOR(nsICancelableRunnable,
36 : NS_ICANCELABLERUNNABLE_IID)
37 :
38 : #endif // nsICancelableRunnable_h__
|