2015-03-02 16:20:00 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_cache_Types_h
|
|
|
|
#define mozilla_dom_cache_Types_h
|
|
|
|
|
2017-09-15 22:25:41 +03:00
|
|
|
#include <functional>
|
2015-03-02 16:20:00 +03:00
|
|
|
#include <stdint.h>
|
2021-03-11 08:53:17 +03:00
|
|
|
#include "mozilla/dom/quota/CommonMetadata.h"
|
2015-03-02 16:20:00 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIFile.h"
|
2017-09-15 22:25:41 +03:00
|
|
|
#include "nsIInputStream.h"
|
2015-03-02 16:20:00 +03:00
|
|
|
#include "nsString.h"
|
|
|
|
|
2022-05-09 23:41:05 +03:00
|
|
|
namespace mozilla::dom::cache {
|
2015-03-02 16:20:00 +03:00
|
|
|
|
|
|
|
enum Namespace {
|
|
|
|
DEFAULT_NAMESPACE,
|
|
|
|
CHROME_ONLY_NAMESPACE,
|
|
|
|
NUMBER_OF_NAMESPACES
|
|
|
|
};
|
2015-04-16 22:00:15 +03:00
|
|
|
static const Namespace INVALID_NAMESPACE = NUMBER_OF_NAMESPACES;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
2021-08-06 15:10:13 +03:00
|
|
|
using CacheId = int64_t;
|
2015-04-03 03:11:41 +03:00
|
|
|
static const CacheId INVALID_CACHE_ID = -1;
|
2015-03-02 16:20:00 +03:00
|
|
|
|
2021-11-24 23:50:37 +03:00
|
|
|
struct CacheDirectoryMetadata : quota::ClientMetadata {
|
2015-03-02 16:20:00 +03:00
|
|
|
nsCOMPtr<nsIFile> mDir;
|
2020-10-20 14:46:31 +03:00
|
|
|
int64_t mDirectoryLockId = -1;
|
2021-11-24 23:50:37 +03:00
|
|
|
|
2021-11-24 23:50:37 +03:00
|
|
|
explicit CacheDirectoryMetadata(quota::PrincipalMetadata aPrincipalMetadata)
|
2021-11-24 23:50:37 +03:00
|
|
|
: quota::ClientMetadata(
|
|
|
|
quota::OriginMetadata{std::move(aPrincipalMetadata),
|
|
|
|
quota::PERSISTENCE_TYPE_DEFAULT},
|
|
|
|
quota::Client::Type::DOMCACHE) {}
|
|
|
|
|
2021-11-24 23:50:37 +03:00
|
|
|
explicit CacheDirectoryMetadata(quota::OriginMetadata aOriginMetadata)
|
2021-11-24 23:50:37 +03:00
|
|
|
: quota::ClientMetadata(std::move(aOriginMetadata),
|
|
|
|
quota::Client::Type::DOMCACHE) {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(aOriginMetadata.mPersistenceType ==
|
|
|
|
quota::PERSISTENCE_TYPE_DEFAULT);
|
|
|
|
}
|
2015-03-02 16:20:00 +03:00
|
|
|
};
|
|
|
|
|
2020-09-11 10:58:34 +03:00
|
|
|
struct DeletionInfo {
|
|
|
|
nsTArray<nsID> mDeletedBodyIdList;
|
|
|
|
int64_t mDeletedPaddingSize = 0;
|
|
|
|
};
|
|
|
|
|
2021-08-06 15:10:13 +03:00
|
|
|
using InputStreamResolver = std::function<void(nsCOMPtr<nsIInputStream>&&)>;
|
2017-09-15 22:25:41 +03:00
|
|
|
|
2017-09-15 22:25:41 +03:00
|
|
|
enum class OpenMode : uint8_t { Eager, Lazy, NumTypes };
|
|
|
|
|
2022-05-09 23:41:05 +03:00
|
|
|
} // namespace mozilla::dom::cache
|
2015-03-02 16:20:00 +03:00
|
|
|
|
|
|
|
#endif // mozilla_dom_cache_Types_h
|