Bug 1941046 - Part 4: Send a callback request for impression and clicks of MARS Top...
[gecko.git] / dom / quota / OriginDirectoryLock.h
blobe7f67f3670ed65be1cfd4852c363ffef4b820c48
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_ORIGINDIRECTORYLOCK_H_
8 #define DOM_QUOTA_ORIGINDIRECTORYLOCK_H_
10 #include "nsStringFwd.h"
11 #include "mozilla/dom/quota/DirectoryLockImpl.h"
12 #include "mozilla/dom/quota/PersistenceType.h"
14 template <class T>
15 class RefPtr;
17 namespace mozilla {
19 template <typename T>
20 class MovingNotNull;
22 } // namespace mozilla
24 namespace mozilla::dom::quota {
26 struct OriginMetadata;
27 class QuotaManager;
29 // A directory lock specialized for a given origin directory.
30 class OriginDirectoryLock : public DirectoryLockImpl {
31 friend class QuotaManager;
33 public:
34 using DirectoryLockImpl::DirectoryLockImpl;
36 // XXX These getters shouldn't exist in the base class, but since some
37 // consumers don't use proper casting to OriginDirectoryLock yet, we keep
38 // them in the base class and have explicit forwarding here.
40 // 'Get' prefix is to avoid name collisions with the enum
41 PersistenceType GetPersistenceType() const {
42 return DirectoryLockImpl::GetPersistenceType();
45 quota::OriginMetadata OriginMetadata() const {
46 return DirectoryLockImpl::OriginMetadata();
49 const nsACString& Origin() const { return DirectoryLockImpl::Origin(); }
51 private:
52 static RefPtr<OriginDirectoryLock> CreateForEviction(
53 MovingNotNull<RefPtr<QuotaManager>> aQuotaManager,
54 PersistenceType aPersistenceType,
55 const quota::OriginMetadata& aOriginMetadata);
58 } // namespace mozilla::dom::quota
60 #endif // DOM_QUOTA_ORIGINDIRECTORYLOCK_H_