/src/mozilla-central/dom/abort/AbortController.h
Line | Count | Source (jump to first uncovered line) |
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 mozilla_dom_AbortController_h |
8 | | #define mozilla_dom_AbortController_h |
9 | | |
10 | | #include "mozilla/dom/BindingDeclarations.h" |
11 | | #include "mozilla/ErrorResult.h" |
12 | | #include "nsCycleCollectionParticipant.h" |
13 | | #include "nsWrapperCache.h" |
14 | | |
15 | | class nsIGlobalObject; |
16 | | |
17 | | namespace mozilla { |
18 | | namespace dom { |
19 | | |
20 | | class AbortSignal; |
21 | | |
22 | | class AbortController final : public nsISupports |
23 | | , public nsWrapperCache |
24 | | { |
25 | | public: |
26 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
27 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AbortController) |
28 | | |
29 | | static already_AddRefed<AbortController> |
30 | | Constructor(const GlobalObject& aGlobal, ErrorResult& aRv); |
31 | | |
32 | | explicit AbortController(nsIGlobalObject* aGlobal); |
33 | | |
34 | | JSObject* |
35 | | WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; |
36 | | |
37 | | nsIGlobalObject* |
38 | | GetParentObject() const; |
39 | | |
40 | | AbortSignal* |
41 | | Signal(); |
42 | | |
43 | | void |
44 | | Abort(); |
45 | | |
46 | | private: |
47 | 0 | ~AbortController() = default; |
48 | | |
49 | | nsCOMPtr<nsIGlobalObject> mGlobal; |
50 | | RefPtr<AbortSignal> mSignal; |
51 | | |
52 | | bool mAborted; |
53 | | }; |
54 | | |
55 | | } // dom namespace |
56 | | } // mozilla namespace |
57 | | |
58 | | #endif // mozilla_dom_AbortController_h |