Backed out 2 changesets (bug 1539720) for causing caret related failures. CLOSED...
[gecko.git] / dom / cache / Types.h
blobb033f0cea4c0bb48c5fe54bd7245c5ec9fe9ddcf
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/. */
7 #ifndef mozilla_dom_cache_Types_h
8 #define mozilla_dom_cache_Types_h
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"
18 namespace mozilla::dom::cache {
20 enum Namespace {
21 DEFAULT_NAMESPACE,
22 CHROME_ONLY_NAMESPACE,
23 NUMBER_OF_NAMESPACES
25 static const Namespace INVALID_NAMESPACE = NUMBER_OF_NAMESPACES;
27 using CacheId = int64_t;
28 static const CacheId INVALID_CACHE_ID = -1;
30 struct CacheDirectoryMetadata : quota::ClientMetadata {
31 nsCOMPtr<nsIFile> mDir;
32 int64_t mDirectoryLockId = -1;
34 explicit CacheDirectoryMetadata(quota::PrincipalMetadata aPrincipalMetadata)
35 : quota::ClientMetadata(
36 quota::OriginMetadata{std::move(aPrincipalMetadata),
37 quota::PERSISTENCE_TYPE_DEFAULT},
38 quota::Client::Type::DOMCACHE) {}
40 explicit CacheDirectoryMetadata(quota::OriginMetadata aOriginMetadata)
41 : quota::ClientMetadata(std::move(aOriginMetadata),
42 quota::Client::Type::DOMCACHE) {
43 MOZ_DIAGNOSTIC_ASSERT(aOriginMetadata.mPersistenceType ==
44 quota::PERSISTENCE_TYPE_DEFAULT);
48 struct DeletionInfo {
49 nsTArray<nsID> mDeletedBodyIdList;
50 int64_t mDeletedPaddingSize = 0;
53 using InputStreamResolver = std::function<void(nsCOMPtr<nsIInputStream>&&)>;
55 enum class OpenMode : uint8_t { Eager, Lazy, NumTypes };
57 } // namespace mozilla::dom::cache
59 #endif // mozilla_dom_cache_Types_h