QuotaRequestBase.h (1545B)
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 file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DOM_QUOTA_QUOTAREQUESTBASE_H_ 8 #define DOM_QUOTA_QUOTAREQUESTBASE_H_ 9 10 #include "NormalOriginOperationBase.h" 11 #include "mozilla/dom/quota/PQuotaRequestParent.h" 12 13 namespace mozilla::dom::quota { 14 15 class RequestResponse; 16 17 class QuotaRequestBase : public NormalOriginOperationBase, 18 public PQuotaRequestParent { 19 public: 20 NS_INLINE_DECL_REFCOUNTING(QuotaRequestBase, override) 21 22 protected: 23 QuotaRequestBase(MovingNotNull<RefPtr<QuotaManager>> aQuotaManager, 24 const char* aName) 25 : NormalOriginOperationBase(std::move(aQuotaManager), aName), 26 mActorDestroyed(false) {} 27 28 virtual ~QuotaRequestBase(); 29 30 void NoteActorDestroyed() { 31 AssertIsOnOwningThread(); 32 33 mActorDestroyed = true; 34 } 35 36 bool IsActorDestroyed() const { 37 AssertIsOnOwningThread(); 38 39 return mActorDestroyed; 40 } 41 42 // Subclasses use this override to set the IPDL response value. 43 virtual void GetResponse(RequestResponse& aResponse) = 0; 44 45 private: 46 virtual void SendResults() override; 47 48 // IPDL methods. 49 virtual void ActorDestroy(ActorDestroyReason aWhy) override; 50 51 bool mActorDestroyed; 52 }; 53 54 } // namespace mozilla::dom::quota 55 56 #endif // DOM_QUOTA_QUOTAREQUESTBASE_H_