tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ClientDirectoryLock.h (2282B)


      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_CLIENTDIRECTORYLOCK_H_
      8 #define DOM_QUOTA_CLIENTDIRECTORYLOCK_H_
      9 
     10 #include "mozilla/dom/quota/Client.h"
     11 #include "mozilla/dom/quota/OriginDirectoryLock.h"
     12 #include "mozilla/dom/quota/PersistenceType.h"
     13 #include "nsStringFwd.h"
     14 
     15 template <class T>
     16 class RefPtr;
     17 
     18 namespace mozilla {
     19 
     20 template <typename T>
     21 class MovingNotNull;
     22 
     23 }  // namespace mozilla
     24 
     25 namespace mozilla::dom {
     26 
     27 template <typename T>
     28 struct Nullable;
     29 
     30 }  // namespace mozilla::dom
     31 
     32 namespace mozilla::dom::quota {
     33 
     34 enum class DirectoryLockCategory : uint8_t;
     35 struct OriginMetadata;
     36 class OriginScope;
     37 class PersistenceScope;
     38 class QuotaManager;
     39 class UniversalDirectoryLock;
     40 
     41 // A directory lock specialized for a given client directory (inside an origin
     42 // directory).
     43 class ClientDirectoryLock final : public OriginDirectoryLock {
     44  friend class QuotaManager;
     45  friend class UniversalDirectoryLock;
     46 
     47 public:
     48  using OriginDirectoryLock::OriginDirectoryLock;
     49 
     50  // XXX This getter shouldn't exist in the root class, but since some
     51  // consumers don't use proper casting to ClientDirectoryLock yet, we keep
     52  // it in the root class and have explicit forwarding here.
     53 
     54  Client::Type ClientType() const { return OriginDirectoryLock::ClientType(); }
     55 
     56 private:
     57  static RefPtr<ClientDirectoryLock> Create(
     58      MovingNotNull<RefPtr<QuotaManager>> aQuotaManager,
     59      PersistenceType aPersistenceType,
     60      const quota::OriginMetadata& aOriginMetadata, Client::Type aClientType,
     61      bool aExclusive);
     62 
     63  static RefPtr<ClientDirectoryLock> Create(
     64      MovingNotNull<RefPtr<QuotaManager>> aQuotaManager,
     65      const PersistenceScope& aPersistenceScope,
     66      const OriginScope& aOriginScope,
     67      const ClientStorageScope& aClientStorageScope, bool aExclusive,
     68      bool aInternal, ShouldUpdateLockIdTableFlag aShouldUpdateLockIdTableFlag,
     69      DirectoryLockCategory aCategory);
     70 };
     71 
     72 }  // namespace mozilla::dom::quota
     73 
     74 #endif  // DOM_QUOTA_CLIENTDIRECTORYLOCK_H_