ForwardDecls.h (3865B)
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 #ifndef DOM_QUOTA_FORWARD_DECLS_H_ 8 #define DOM_QUOTA_FORWARD_DECLS_H_ 9 10 #include <cstdint> 11 #include <functional> 12 13 #include "mozilla/dom/quota/CommonMetadataArrayFwd.h" 14 #include "mozilla/dom/quota/Config.h" 15 #include "nsStringFwd.h" 16 #include "nsTArrayForwardDeclare.h" 17 18 enum class nsresult : uint32_t; 19 template <class T> 20 class RefPtr; 21 22 namespace mozilla { 23 24 using CStringArray = nsTArray<nsCString>; 25 26 template <class T> 27 class Maybe; 28 29 using MaybeCStringArray = Maybe<CStringArray>; 30 31 #ifdef QM_ERROR_STACKS_ENABLED 32 class QMResult; 33 #else 34 using QMResult = nsresult; 35 #endif 36 37 struct Ok; 38 template <typename V, typename E> 39 class Result; 40 41 using OkOrErr = Result<Ok, QMResult>; 42 43 template <typename ResolveValueT, typename RejectValueT, bool IsExclusive> 44 class MozPromise; 45 46 using BoolPromise = MozPromise<bool, nsresult, false>; 47 using Int64Promise = MozPromise<int64_t, nsresult, false>; 48 using UInt64Promise = MozPromise<uint64_t, nsresult, false>; 49 using CStringArrayPromise = MozPromise<CStringArray, nsresult, true>; 50 51 using MaybeCStringArrayPromise = MozPromise<MaybeCStringArray, nsresult, true>; 52 53 using ExclusiveBoolPromise = MozPromise<bool, nsresult, true>; 54 55 namespace ipc { 56 57 class BoolResponse; 58 class UInt64Response; 59 class CStringArrayResponse; 60 enum class ResponseRejectReason; 61 62 using BoolResponsePromise = 63 MozPromise<BoolResponse, ResponseRejectReason, true>; 64 using UInt64ResponsePromise = 65 MozPromise<UInt64Response, ResponseRejectReason, true>; 66 using CStringArrayResponsePromise = 67 MozPromise<CStringArrayResponse, ResponseRejectReason, true>; 68 69 using NSResultResolver = std::function<void(const nsresult&)>; 70 71 using BoolResponseResolver = std::function<void(const BoolResponse&)>; 72 using UInt64ResponseResolver = std::function<void(const UInt64Response&)>; 73 using CStringArrayResponseResolver = 74 std::function<void(const CStringArrayResponse&)>; 75 76 } // namespace ipc 77 78 namespace dom::quota { 79 80 class ClientDirectoryLock; 81 class UniversalDirectoryLock; 82 83 using ClientDirectoryLockPromise = 84 MozPromise<RefPtr<ClientDirectoryLock>, nsresult, true>; 85 using UniversalDirectoryLockPromise = 86 MozPromise<RefPtr<UniversalDirectoryLock>, nsresult, true>; 87 88 struct ClientMetadata; 89 struct OriginMetadata; 90 struct PrincipalMetadata; 91 using ClientMetadataArray = nsTArray<ClientMetadata>; 92 using OriginMetadataArray = nsTArray<OriginMetadata>; 93 using PrincipalMetadataArray = nsTArray<PrincipalMetadata>; 94 using MaybePrincipalMetadataArray = Maybe<PrincipalMetadataArray>; 95 class UsageInfo; 96 97 using ClientMetadataArrayPromise = 98 MozPromise<ClientMetadataArray, nsresult, true>; 99 using OriginMetadataArrayPromise = 100 MozPromise<OriginMetadataArray, nsresult, true>; 101 using OriginUsageMetadataArrayPromise = 102 MozPromise<OriginUsageMetadataArray, nsresult, true>; 103 using MaybePrincipalMetadataArrayPromise = 104 MozPromise<MaybePrincipalMetadataArray, nsresult, true>; 105 using UsageInfoPromise = MozPromise<UsageInfo, nsresult, false>; 106 107 class OriginUsageMetadataArrayResponse; 108 class UsageInfoResponse; 109 110 using OriginUsageMetadataArrayResponsePromise = 111 MozPromise<OriginUsageMetadataArrayResponse, 112 mozilla::ipc::ResponseRejectReason, true>; 113 using UsageInfoResponsePromise = 114 MozPromise<UsageInfoResponse, mozilla::ipc::ResponseRejectReason, true>; 115 116 using OriginUsageMetadataArrayResponseResolver = 117 std::function<void(OriginUsageMetadataArrayResponse&&)>; 118 using UsageInfoResponseResolver = std::function<void(const UsageInfoResponse&)>; 119 120 } // namespace dom::quota 121 122 } // namespace mozilla 123 124 #endif // DOM_QUOTA_FORWARD_DECLS_H_