OriginDirectoryLock.h (1792B)
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_ORIGINDIRECTORYLOCK_H_ 8 #define DOM_QUOTA_ORIGINDIRECTORYLOCK_H_ 9 10 #include "mozilla/dom/quota/DirectoryLockImpl.h" 11 #include "mozilla/dom/quota/PersistenceType.h" 12 #include "nsStringFwd.h" 13 14 template <class T> 15 class RefPtr; 16 17 namespace mozilla { 18 19 template <typename T> 20 class MovingNotNull; 21 22 } // namespace mozilla 23 24 namespace mozilla::dom::quota { 25 26 struct OriginMetadata; 27 class QuotaManager; 28 29 // A directory lock specialized for a given origin directory. 30 class OriginDirectoryLock : public DirectoryLockImpl { 31 friend class QuotaManager; 32 33 public: 34 using DirectoryLockImpl::DirectoryLockImpl; 35 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. 39 40 // 'Get' prefix is to avoid name collisions with the enum 41 PersistenceType GetPersistenceType() const { 42 return DirectoryLockImpl::GetPersistenceType(); 43 } 44 45 quota::OriginMetadata OriginMetadata() const { 46 return DirectoryLockImpl::OriginMetadata(); 47 } 48 49 const nsACString& Origin() const { return DirectoryLockImpl::Origin(); } 50 51 private: 52 static RefPtr<OriginDirectoryLock> CreateForEviction( 53 MovingNotNull<RefPtr<QuotaManager>> aQuotaManager, 54 PersistenceType aPersistenceType, 55 const quota::OriginMetadata& aOriginMetadata); 56 }; 57 58 } // namespace mozilla::dom::quota 59 60 #endif // DOM_QUOTA_ORIGINDIRECTORYLOCK_H_