Bug 1913377 - Comment and assert that `allowedScope` has a very limited set of values...
[gecko.git] / dom / quota / ClientImpl.h
blob9602345e5dfb42e142f1e0bdb535fa161869afb0
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_QUOTA_CLIENTIMPL_H_
8 #define DOM_QUOTA_CLIENTIMPL_H_
10 #include "mozilla/dom/quota/DirectoryLock.h"
12 namespace mozilla::dom::quota {
14 // static
15 template <typename T>
16 bool Client::IsLockForObjectContainedInLockTable(
17 const T& aObject, const DirectoryLockIdTable& aIds) {
18 const auto& maybeDirectoryLock = aObject.MaybeDirectoryLockRef();
20 MOZ_ASSERT(maybeDirectoryLock.isSome());
22 return aIds.Has(maybeDirectoryLock->Id());
25 // static
26 template <typename T>
27 bool Client::IsLockForObjectAcquiredAndContainedInLockTable(
28 const T& aObject, const DirectoryLockIdTable& aIds) {
29 const auto& maybeDirectoryLock = aObject.MaybeDirectoryLockRef();
31 return maybeDirectoryLock && aIds.Has(maybeDirectoryLock->Id());
34 } // namespace mozilla::dom::quota
36 #endif // DOM_QUOTA_CLIENTIMPL_H_