Bug 1833854 - Part 4: Move all code that deals with maintaining invariants into a...
[gecko.git] / dom / quota / InitializationTypes.cpp
blobfffb4693aa5617997a74b3e06799022476a2bbb7
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 #include "InitializationTypes.h"
9 namespace mozilla::dom::quota {
11 // static
12 nsLiteralCString StringGenerator::GetString(
13 const Initialization aInitialization) {
14 switch (aInitialization) {
15 case Initialization::Storage:
16 return "Storage"_ns;
17 case Initialization::TemporaryStorage:
18 return "TemporaryStorage"_ns;
19 case Initialization::DefaultRepository:
20 return "DefaultRepository"_ns;
21 case Initialization::TemporaryRepository:
22 return "TemporaryRepository"_ns;
23 case Initialization::UpgradeStorageFrom0_0To1_0:
24 return "UpgradeStorageFrom0_0To1_0"_ns;
25 case Initialization::UpgradeStorageFrom1_0To2_0:
26 return "UpgradeStorageFrom1_0To2_0"_ns;
27 case Initialization::UpgradeStorageFrom2_0To2_1:
28 return "UpgradeStorageFrom2_0To2_1"_ns;
29 case Initialization::UpgradeStorageFrom2_1To2_2:
30 return "UpgradeStorageFrom2_1To2_2"_ns;
31 case Initialization::UpgradeStorageFrom2_2To2_3:
32 return "UpgradeStorageFrom2_2To2_3"_ns;
33 case Initialization::UpgradeFromIndexedDBDirectory:
34 return "UpgradeFromIndexedDBDirectory"_ns;
35 case Initialization::UpgradeFromPersistentStorageDirectory:
36 return "UpgradeFromPersistentStorageDirectory"_ns;
38 default:
39 MOZ_CRASH("Bad initialization value!");
43 // static
44 nsLiteralCString StringGenerator::GetString(
45 const OriginInitialization aOriginInitialization) {
46 switch (aOriginInitialization) {
47 case OriginInitialization::PersistentOrigin:
48 return "PersistentOrigin"_ns;
49 case OriginInitialization::TemporaryOrigin:
50 return "TemporaryOrigin"_ns;
52 default:
53 MOZ_CRASH("Bad origin initialization value!");
57 } // namespace mozilla::dom::quota