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"
15 struct CreateIfNonExistent
;
18 namespace mozilla::dom
{
20 enum class LSOriginInitialization
{
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
;
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_