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 #ifndef DOM_QUOTA_CLIENTIMPL_H_ 8 #define DOM_QUOTA_CLIENTIMPL_H_ 9 10 #include "mozilla/dom/quota/DirectoryLock.h" 11 12 namespace mozilla::dom::quota { 13 14 // static 15 template <typename T> IsLockForObjectContainedInLockTable(const T & aObject,const DirectoryLockIdTable & aIds)16bool Client::IsLockForObjectContainedInLockTable( 17 const T& aObject, const DirectoryLockIdTable& aIds) { 18 const auto& maybeDirectoryLock = aObject.MaybeDirectoryLockRef(); 19 20 MOZ_ASSERT(maybeDirectoryLock.isSome()); 21 22 return aIds.Has(maybeDirectoryLock->Id()); 23 } 24 25 // static 26 template <typename T> IsLockForObjectAcquiredAndContainedInLockTable(const T & aObject,const DirectoryLockIdTable & aIds)27bool Client::IsLockForObjectAcquiredAndContainedInLockTable( 28 const T& aObject, const DirectoryLockIdTable& aIds) { 29 const auto& maybeDirectoryLock = aObject.MaybeDirectoryLockRef(); 30 31 return maybeDirectoryLock && aIds.Has(maybeDirectoryLock->Id()); 32 } 33 34 } // namespace mozilla::dom::quota 35 36 #endif // DOM_QUOTA_CLIENTIMPL_H_ 37