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_ORIGINOPERATIONBASE_H_
8 #define DOM_QUOTA_ORIGINOPERATIONBASE_H_
10 #include "ErrorList.h"
11 #include "mozilla/NotNull.h"
12 #include "mozilla/RefPtr.h"
13 #include "mozilla/dom/quota/BackgroundThreadObject.h"
14 #include "mozilla/dom/quota/Config.h"
15 #include "mozilla/dom/quota/ForwardDecls.h"
16 #include "mozilla/dom/quota/OriginOperationCallbacks.h"
17 #include "mozilla/dom/quota/StringifyUtils.h"
18 #include "nsISupportsImpl.h"
20 namespace mozilla::dom::quota
{
24 class OriginOperationBase
: public BackgroundThreadObject
,
25 public OriginOperationCallbackHolders
,
26 public Stringifyable
{
28 const NotNull
<RefPtr
<QuotaManager
>> mQuotaManager
;
32 #ifdef QM_COLLECTING_OPERATION_TELEMETRY
33 const char* mName
= nullptr;
37 NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
39 #ifdef QM_COLLECTING_OPERATION_TELEMETRY
40 const char* Name() const { return mName
; }
43 void RunImmediately();
45 OriginOperationCallbacks
GetCallbacks(
46 const OriginOperationCallbackOptions
& aCallbackOptions
);
49 OriginOperationBase(MovingNotNull
<RefPtr
<QuotaManager
>>&& aQuotaManager
,
53 virtual ~OriginOperationBase();
55 virtual nsresult
DoInit(QuotaManager
& aQuotaManager
);
57 virtual RefPtr
<BoolPromise
> Open() = 0;
60 virtual nsresult
DirectoryOpen();
63 virtual nsresult
DoDirectoryWork(QuotaManager
& aQuotaManager
) = 0;
65 virtual void UnblockOpen() = 0;
68 void DoStringify(nsACString
& aData
) override
{}
71 } // namespace mozilla::dom::quota
73 #endif // DOM_QUOTA_ORIGINOPERATIONBASE_H_