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_ORIGINOPERATIONS_H_
8 #define DOM_QUOTA_ORIGINOPERATIONS_H_
12 #include "mozilla/dom/quota/Client.h"
13 #include "mozilla/dom/quota/PersistenceType.h"
14 #include "nsTArrayForwardDeclare.h"
25 class OriginAttributesPattern
;
27 namespace dom::quota
{
30 class GetFullOriginMetadataParams
;
31 class NormalOriginOperationBase
;
32 class OriginDirectoryLock
;
33 struct OriginMetadata
;
34 class OriginOperationBase
;
36 class QuotaRequestBase
;
37 class QuotaUsageRequestBase
;
39 template <typename ResolveValueT
, bool IsExclusive
= false>
40 class ResolvableNormalOriginOp
;
41 class UniversalDirectoryLock
;
42 class UsageRequestParams
;
44 RefPtr
<OriginOperationBase
> CreateFinalizeOriginEvictionOp(
45 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
46 nsTArray
<RefPtr
<OriginDirectoryLock
>>&& aLocks
);
48 RefPtr
<NormalOriginOperationBase
> CreateSaveOriginAccessTimeOp(
49 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
50 const OriginMetadata
& aOriginMetadata
, int64_t aTimestamp
);
52 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateClearPrivateRepositoryOp(
53 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
55 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateShutdownStorageOp(
56 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
58 RefPtr
<ResolvableNormalOriginOp
<OriginUsageMetadataArray
, true>>
59 CreateGetUsageOp(MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
62 RefPtr
<ResolvableNormalOriginOp
<UsageInfo
>> CreateGetOriginUsageOp(
63 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
64 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
);
66 RefPtr
<QuotaRequestBase
> CreateStorageNameOp(
67 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
69 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateStorageInitializedOp(
70 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
72 RefPtr
<ResolvableNormalOriginOp
<bool>> CreatePersistentStorageInitializedOp(
73 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
75 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateTemporaryStorageInitializedOp(
76 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
78 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateTemporaryGroupInitializedOp(
79 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
80 const PrincipalMetadata
& aPrincipalMetadata
);
82 RefPtr
<ResolvableNormalOriginOp
<bool>> CreatePersistentOriginInitializedOp(
83 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
84 const OriginMetadata
& aOriginMetadata
);
86 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateTemporaryOriginInitializedOp(
87 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
88 const OriginMetadata
& aOriginMetadata
);
90 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateInitOp(
91 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
92 RefPtr
<UniversalDirectoryLock
> aDirectoryLock
);
94 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateInitializePersistentStorageOp(
95 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
96 RefPtr
<UniversalDirectoryLock
> aDirectoryLock
);
98 RefPtr
<ResolvableNormalOriginOp
<MaybePrincipalMetadataArray
, true>>
99 CreateInitTemporaryStorageOp(MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
100 RefPtr
<UniversalDirectoryLock
> aDirectoryLock
);
102 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateInitializeTemporaryGroupOp(
103 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
104 const PrincipalMetadata
& aPrincipalMetadata
,
105 RefPtr
<UniversalDirectoryLock
> aDirectoryLock
);
107 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateInitializePersistentOriginOp(
108 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
109 const OriginMetadata
& aOriginMetadata
,
110 RefPtr
<UniversalDirectoryLock
> aDirectoryLock
);
112 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateInitializeTemporaryOriginOp(
113 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
114 const OriginMetadata
& aOriginMetadata
, bool aCreateIfNonExistent
,
115 RefPtr
<UniversalDirectoryLock
> aDirectoryLock
);
117 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateInitializePersistentClientOp(
118 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
119 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
,
120 const Client::Type aClientType
);
122 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateInitializeTemporaryClientOp(
123 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
124 const PersistenceType aPersistenceType
,
125 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
,
126 const Client::Type aClientType
);
128 RefPtr
<QuotaRequestBase
> CreateGetFullOriginMetadataOp(
129 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
130 const GetFullOriginMetadataParams
& aParams
);
132 RefPtr
<ResolvableNormalOriginOp
<uint64_t>> CreateGetCachedOriginUsageOp(
133 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
134 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
);
136 RefPtr
<ResolvableNormalOriginOp
<CStringArray
, true>> CreateListCachedOriginsOp(
137 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
139 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateClearStorageOp(
140 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
142 RefPtr
<ResolvableNormalOriginOp
<OriginMetadataArray
, true>> CreateClearOriginOp(
143 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
144 const Maybe
<PersistenceType
>& aPersistenceType
,
145 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
);
147 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateClearClientOp(
148 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
149 Maybe
<PersistenceType
> aPersistenceType
,
150 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
,
151 Client::Type aClientType
);
153 RefPtr
<ResolvableNormalOriginOp
<OriginMetadataArray
, true>>
154 CreateClearStoragesForOriginPrefixOp(
155 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
156 const Maybe
<PersistenceType
>& aPersistenceType
,
157 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
);
159 RefPtr
<ResolvableNormalOriginOp
<OriginMetadataArray
, true>> CreateClearDataOp(
160 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
161 const OriginAttributesPattern
& aPattern
);
163 RefPtr
<ResolvableNormalOriginOp
<OriginMetadataArray
, true>>
164 CreateShutdownOriginOp(MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
165 Maybe
<PersistenceType
> aPersistenceType
,
166 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
);
168 RefPtr
<ResolvableNormalOriginOp
<bool>> CreateShutdownClientOp(
169 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
170 Maybe
<PersistenceType
> aPersistenceType
,
171 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
,
172 Client::Type aClientType
);
174 RefPtr
<QuotaRequestBase
> CreatePersistedOp(
175 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
176 const RequestParams
& aParams
);
178 RefPtr
<QuotaRequestBase
> CreatePersistOp(
179 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
180 const RequestParams
& aParams
);
182 RefPtr
<QuotaRequestBase
> CreateEstimateOp(
183 MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
,
184 const EstimateParams
& aParams
);
186 RefPtr
<ResolvableNormalOriginOp
<CStringArray
, /* IsExclusive */ true>>
187 CreateListOriginsOp(MovingNotNull
<RefPtr
<QuotaManager
>> aQuotaManager
);
189 } // namespace dom::quota
190 } // namespace mozilla
192 #endif // DOM_QUOTA_ORIGINOPERATIONS_H_