QuotaUsageRequestChild.cpp (1390B)
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 "QuotaUsageRequestChild.h" 8 9 // Local includes 10 #include "QuotaRequests.h" 11 12 // Global includes 13 #include "mozilla/Assertions.h" 14 15 namespace mozilla::dom::quota { 16 17 QuotaUsageRequestChild::QuotaUsageRequestChild(UsageRequest* aRequest) 18 : mRequest(aRequest) { 19 AssertIsOnOwningThread(); 20 21 MOZ_COUNT_CTOR(quota::QuotaUsageRequestChild); 22 } 23 24 QuotaUsageRequestChild::~QuotaUsageRequestChild() { 25 // Can't assert owning thread here because the request is cleared. 26 27 MOZ_COUNT_DTOR(quota::QuotaUsageRequestChild); 28 } 29 30 #ifdef DEBUG 31 32 void QuotaUsageRequestChild::AssertIsOnOwningThread() const { 33 MOZ_ASSERT(mRequest); 34 mRequest->AssertIsOnOwningThread(); 35 } 36 37 #endif // DEBUG 38 39 mozilla::ipc::IPCResult QuotaUsageRequestChild::Recv__delete__() { 40 AssertIsOnOwningThread(); 41 MOZ_ASSERT(mRequest); 42 43 return IPC_OK(); 44 } 45 46 void QuotaUsageRequestChild::ActorDestroy(ActorDestroyReason aWhy) { 47 AssertIsOnOwningThread(); 48 49 if (mRequest) { 50 mRequest->ClearBackgroundActor(); 51 #ifdef DEBUG 52 mRequest = nullptr; 53 #endif 54 } 55 } 56 57 } // namespace mozilla::dom::quota