OriginDirectoryLock.cpp (1578B)
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/. */ 6 7 #include "OriginDirectoryLock.h" 8 9 #include <utility> 10 11 #include "mozilla/Assertions.h" 12 #include "mozilla/NotNull.h" 13 #include "mozilla/RefPtr.h" 14 #include "mozilla/dom/Nullable.h" 15 #include "mozilla/dom/quota/CommonMetadata.h" 16 #include "mozilla/dom/quota/DirectoryLockCategory.h" 17 #include "mozilla/dom/quota/OriginScope.h" 18 #include "mozilla/dom/quota/PersistenceScope.h" 19 #include "mozilla/dom/quota/QuotaManager.h" 20 #include "nsString.h" 21 22 namespace mozilla::dom::quota { 23 24 // static 25 RefPtr<OriginDirectoryLock> OriginDirectoryLock::CreateForEviction( 26 MovingNotNull<RefPtr<QuotaManager>> aQuotaManager, 27 PersistenceType aPersistenceType, 28 const quota::OriginMetadata& aOriginMetadata) { 29 MOZ_ASSERT(aPersistenceType != PERSISTENCE_TYPE_INVALID); 30 MOZ_ASSERT(!aOriginMetadata.mOrigin.IsEmpty()); 31 MOZ_ASSERT(!aOriginMetadata.mStorageOrigin.IsEmpty()); 32 33 return MakeRefPtr<OriginDirectoryLock>( 34 std::move(aQuotaManager), 35 PersistenceScope::CreateFromValue(aPersistenceType), 36 OriginScope::FromOrigin(aOriginMetadata), 37 ClientStorageScope::CreateFromNull(), 38 /* aExclusive */ true, /* aInternal */ true, 39 ShouldUpdateLockIdTableFlag::No, DirectoryLockCategory::UninitOrigins); 40 } 41 42 } // namespace mozilla::dom::quota