PlayPromise.h (1081B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=2 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 file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef __PlayPromise_h__ 8 #define __PlayPromise_h__ 9 10 #include "mozilla/dom/Promise.h" 11 12 namespace mozilla::dom { 13 14 class PlayPromise : public Promise { 15 public: 16 static already_AddRefed<PlayPromise> Create(nsIGlobalObject* aGlobal, 17 ErrorResult& aRv); 18 19 using PlayPromiseArr = nsTArray<RefPtr<PlayPromise>>; 20 static void ResolvePromisesWithUndefined(const PlayPromiseArr& aPromises); 21 static void RejectPromises(const PlayPromiseArr& aPromises, nsresult aError); 22 23 ~PlayPromise(); 24 void MaybeResolveWithUndefined(); 25 void MaybeReject(nsresult aReason); 26 27 private: 28 explicit PlayPromise(nsIGlobalObject* aGlobal); 29 bool mFulfilled = false; 30 }; 31 32 } // namespace mozilla::dom 33 34 #endif // __PlayPromise_h__