QuotaUsageRequestParent.cpp (1153B)
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 #include "QuotaUsageRequestParent.h" 8 9 namespace mozilla::dom::quota { 10 11 QuotaUsageRequestParent::~QuotaUsageRequestParent() { 12 AssertIsOnOwningThread(); 13 } 14 15 RefPtr<BoolPromise> QuotaUsageRequestParent::OnCancel() { 16 AssertIsOnOwningThread(); 17 18 return mCancelPromiseHolder.Ensure(__func__); 19 } 20 21 void QuotaUsageRequestParent::Destroy() { 22 AssertIsOnOwningThread(); 23 24 if (CanSend()) { 25 (void)PQuotaUsageRequestParent::Send__delete__(this); 26 } 27 } 28 29 mozilla::ipc::IPCResult QuotaUsageRequestParent::RecvCancel() { 30 AssertIsOnOwningThread(); 31 32 mCancelPromiseHolder.ResolveIfExists(true, __func__); 33 34 return IPC_OK(); 35 } 36 37 void QuotaUsageRequestParent::ActorDestroy(ActorDestroyReason aWhy) { 38 AssertIsOnOwningThread(); 39 40 mCancelPromiseHolder.RejectIfExists(NS_ERROR_FAILURE, __func__); 41 } 42 43 } // namespace mozilla::dom::quota