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 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_cache_Types_h 8 #define mozilla_dom_cache_Types_h 9 10 #include <functional> 11 #include <stdint.h> 12 #include "mozilla/dom/quota/CommonMetadata.h" 13 #include "nsCOMPtr.h" 14 #include "nsIFile.h" 15 #include "nsIInputStream.h" 16 #include "nsString.h" 17 18 namespace mozilla { 19 namespace dom { 20 namespace cache { 21 22 enum Namespace { 23 DEFAULT_NAMESPACE, 24 CHROME_ONLY_NAMESPACE, 25 NUMBER_OF_NAMESPACES 26 }; 27 static const Namespace INVALID_NAMESPACE = NUMBER_OF_NAMESPACES; 28 29 typedef int64_t CacheId; 30 static const CacheId INVALID_CACHE_ID = -1; 31 32 // XXX Rename to OriginMetadata. 33 // XXX Consider inheritance from ClientMetadata. 34 struct QuotaInfo : quota::OriginMetadata { 35 nsCOMPtr<nsIFile> mDir; 36 int64_t mDirectoryLockId = -1; 37 }; 38 39 struct DeletionInfo { 40 nsTArray<nsID> mDeletedBodyIdList; 41 int64_t mDeletedPaddingSize = 0; 42 }; 43 44 typedef std::function<void(nsCOMPtr<nsIInputStream>&&)> InputStreamResolver; 45 46 enum class OpenMode : uint8_t { Eager, Lazy, NumTypes }; 47 48 } // namespace cache 49 } // namespace dom 50 } // namespace mozilla 51 52 #endif // mozilla_dom_cache_Types_h 53