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/. */
7 #ifndef DOM_QUOTA_NORMALORIGINOPERATIONBASE_H_
8 #define DOM_QUOTA_NORMALORIGINOPERATIONBASE_H_
10 #include "OriginOperationBase.h"
11 #include "mozilla/Atomics.h"
12 #include "mozilla/dom/quota/CheckedUnsafePtr.h"
14 namespace mozilla::dom::quota
{
16 class NormalOriginOperationBase
17 : public OriginOperationBase
,
18 public SupportsCheckedUnsafePtr
<CheckIf
<DiagnosticAssertEnabled
>> {
20 mozilla::Atomic
<bool> mCanceled
;
22 // If we want to only forward declare DirectoryLock which is referenced by
23 // the mDirectoryLock member then the constructor and destructor must be
24 // defined in the cpp where DirectoryLock is fully declared (DirectoryLock.h
25 // is included). The compiler would complain otherwise because it wouldn't
26 // know how to call DirectoryLock::AddRef/Release in the constructor and
28 NormalOriginOperationBase(MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
31 ~NormalOriginOperationBase();
33 virtual RefPtr
<BoolPromise
> OpenDirectory() = 0;
35 // Used to send results before unblocking open.
36 virtual void SendResults() = 0;
38 virtual void CloseDirectory() = 0;
41 virtual RefPtr
<BoolPromise
> Open() override
;
43 virtual void UnblockOpen() override
;
46 } // namespace mozilla::dom::quota
48 #endif // DOM_QUOTA_NORMALORIGINOPERATIONBASE_H_