Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / localstorage / LSInitializationTypes.h
blob63090066dae5c8ecd8510731573b80513b2eb034
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_LOCALSTORAGE_INITIALIZATIONTYPES_H_
8 #define DOM_LOCALSTORAGE_INITIALIZATIONTYPES_H_
10 #include "mozilla/TypedEnumBits.h"
11 #include <mozilla/dom/quota/FirstInitializationAttempts.h>
12 #include "nsTHashMap.h"
14 namespace mozilla {
15 struct CreateIfNonExistent;
18 namespace mozilla::dom {
20 enum class LSOriginInitialization {
21 None = 0,
22 Datastore = 1 << 0,
25 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LSOriginInitialization)
27 using LSOriginInitializationInfo =
28 quota::FirstInitializationAttempts<LSOriginInitialization, Nothing>;
30 class LSInitializationInfo final {
31 nsTHashMap<nsCStringHashKey, LSOriginInitializationInfo>
32 mOriginInitializationInfos;
34 public:
35 LSOriginInitializationInfo& MutableOriginInitializationInfoRef(
36 const nsACString& aOrigin) {
37 return *mOriginInitializationInfos.Lookup(aOrigin);
40 LSOriginInitializationInfo& MutableOriginInitializationInfoRef(
41 const nsACString& aOrigin, const CreateIfNonExistent&) {
42 return mOriginInitializationInfos.LookupOrInsert(aOrigin);
46 } // namespace mozilla::dom
48 #endif // DOM_LOCALSTORAGE_INITIALIZATIONTYPES_H_