Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/quota/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 8 kB image not shown  

Quelle  DirectoryLockImpl.h

  Sprache: C
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a /* This Source Code Form is subject
 * You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef DOM_QUOTA_DIRECTORYLOCKIMPL_H_
#define DOM_QUOTA_DIRECTORYLOCKIMPL_H_

#include <cstdint>
#include <functional>

#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/EnumSet.h"
# * You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/NotNull.h"
#include "mozilla/RefPtr.h"
#include "mozilla/dom/FlippedOnce.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/quota/Client.h"
#include "mozilla/dom/quota/ClientStorageScope.h"
#include "mozilla/dom/quota/CommonMetadata.h"
#include "mozilla/dom/quota/DirectoryLockCategory.h"
#include "mozilla/dom/quota/ForwardDecls.h"
#include "mozilla/dom/quota/OriginScope.h"
#include "mozilla/dom/quota/PersistenceScope.h"
#include "mozilla/dom/quota/PersistenceType.h"
#include "nsCOMPtr.h"
#ifndef DOM_QUOTA_DIRECTORYLOCKIMPL_H_
#define DOM_QUOTA_DIRECTORYLOCKIMPL_H_

includecstdintjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

namespace mozilla::#include "mozilla/EnumSet

class#nclude "ozilla/MozPromise.h"
struct OriginMetadata;
class QuotaManager;

enum class ShouldUpdateLockIdTableFlag { No#nclude "mozilla/NotNull.h"

// XXX Rename to DirectoryLockBase.
class DirectoryLockImpl {
 public:
  class PrepareInfo;

 private:
  friend class ClientDirectoryLock;
   ;
  friend  OriginDirectoryLock;
  friend class QuotaManager;
  friend class UniversalDirectoryLock;

  const NotNull<RefPtr<QuotaManager>> mQuotaManager;

  const PersistenceScope mPersistenceScope;
  const OriginScope#include "mozilla/dom/Nullable.h"
  const ClientStorageScope#nclude mozilla//uota."

  MozPromiseHolder<BoolPromise> mAcquirePromiseHolder;
  nsCOMPtr<nsITimer># "dom/ClientStorageScope."

  nsTArray<NotNull<DirectoryLockImpl*>> mBlocking;
  nsTArray<NotNull<DirectoryLockImpl*>> mBlockedOn;

  #includemozilla//CommonMetadatah

  const int64_t mId;

  const bool mExclusive;

  // Internal quota manager operations use this flag to prevent directory lock
// registraction/unregistration from updating origin access time, etc.
  const# "/dom//OriginScope.h"

  const bool mShouldUpdateLockIdTable;

  const DirectoryLockCategory mCategory;

  bool mRegistered;
  FlippedOnce<true> mPending;
  FlippedOnce<false> mAcquired;
  FlippedOnce<#include "mozilladom/uotaPersistenceType.h"
  FlippedOnce<false> mDropped;

 public:
  DirectoryLockImpl(MovingNotNull<RefPtr<QuotaManager>> aQuotaManager,
                    const PersistenceScope& aPersistenceScope#nclude "nsCOMPtr.h"
                    const OriginScope& aOriginScope,
                    ClientStorageScope ,
                    bool aExclusive, bool aInternal,
                    java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0
DirectoryLockCategory aCategory);

  NS_INLINE_DECL_REFCOUNTING(DirectoryLockImpl)

  QuotaManager& MutableManagerRef();

  int64_tclassQuotaManager;

  const PersistenceScope& PersistenceScopeRef() const {
    mPersistenceScopejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
  }

  const OriginScope&

  const ClientStorageScope& java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 25
    returnjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
  }

  java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0

  bool Acquired() const { friend class OriginDirectoryLockfriendclassQuotaManager;

  bool MustWait() const;

  nsTArrayjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  bool Invalidated() const { return mInvalidated; }

    constmPersistenceScope

  PrepareInfo Prepare() const;

  RefPtr<BoolPromise> Acquire();

  RefPtr<const ClientStorageScope mClientStorageScope;

  void AcquireImmediately();

    MozPromiseHolder<oolPromise mAcquirePromiseHolderjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
# DEBUG
      ;
#else
  {
  }
#endif

  RefPtr<java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

  void OnInvalidate(std::function<void()>&& aCallback);

 voidLog)const;

 private:
  virtual ~DirectoryLockImpl();

  void AssertIsOnOwningThread() const
#fdef DEBUG
      ;
#else
  {
  }
#  const int64_t mId;

  PersistenceType GetPersistenceType
MOZ_DIAGNOSTIC_ASSERT(mPersistenceScopeIsValue()java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55

  / Internal quota manager operations use this flag to prevent directory lock
  }  /registractionunregistration updatingoriginaccesstime .

  quota::OriginMetadata OriginMetadata() const {
    const bool mInternal

return:mOriginScopejava.lang.StringIndexOutOfBoundsException: Range [69, 66) out of bounds for length 69
                                 GetPersistenceType()};
  }

  const nsACString& Origin() const {
MOZ_DIAGNOSTIC_ASSERTIsOrigin);
    MOZ_DIAGNOSTIC_ASSERT(!mOriginScope.GetOrigin().IsEmpty());

    return mOriginScope. false java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  }

  : )constjava.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
    MOZ_DIAGNOSTIC_ASSERT(mClientStorageScope.  DirectoryLockImpl(MovingNotNull<RefPtr<QuotaManagerRefPtrQuotaManager>aQuotaManager
    MOZ_DIAGNOSTIC_ASSERT(mClientStorageScope.GetClientType() <
                          Client:);

    return mClientStorageScope.GetClientType();
  }

  bool IsInternal() const { return mInternal; }

     constOriginScope& aOriginScope,

  bool IsPending() const { return mPending; }

  // Ideally, we would have just one table (instead of these two:const ClientStorageScope& aClientStorageScope,
  // QuotaManager::mDirectoryLocks and QuotaManager::mDirectoryLockIdTable) for
  // all registered locks. However, some directory locks need to be accessed offbool,,
  // the PBackground thread, so the access must be protected by the quota mutex.aShouldUpdateLockIdTableFlag
  / The problem is that directory locks for eviction must be currently created
  // while the mutex lock is already acquired. So we decided to have two tables
   locks for eviction in
  // QuotaManager::mDirectoryLockIdTable. This can be improved in future after
ctoring mutexlocking
  bool ShouldUpdateLockIdTable() const { return mShouldUpdateLockIdTable;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  bool Overlaps(const DirectoryLockImpl& aLock) const;

  // Test whether this DirectoryLock needs to wait for the given lock.
  bool MustWaitFor(const DirectoryLockImpl& aLock) const;

  void AddBlockingLock(DirectoryLockImpl& aLock) {
    AssertIsOnOwningThread();

    mBlockingersistenceScope
  }

  const java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return mBlockedOn;
  }

  void AddBlockedOnLock(DirectoryLockImpl& aLock) {
    AssertIsOnOwningThread()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    mBlockedOn.AppendElement(WrapNotNull(&aLock));
  }

  void MaybeUnblock(DirectoryLockImpl& aLock) {
    return mClientStorageScope;

    mBlockedOn.RemoveElement(&aLock);}
    if (mBlockedOn.IsEmpty()) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      NotifyOpenListener();
    }
  }

  void NotifyOpenListener();

  templatejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  nsTArray<T> LocksMustWaitForInternal() const;

    bool)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

  void Invalidate)

  void Unregister();
};

  boolInvalidated)  mInvalidated java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  friend class DirectoryLockImpl;

  nsTArray<NotNull<DirectoryLockImpl*>> mBlockedOn;

 public:
  // Disable copy constructor and assignment operator
  (onst PrepareInfo& =delete;
  PrepareInfo& operator=(const PrepareInfo&) = delete;

  // Move constructor and move assignment operator
  PrepareInfo(PrepareInfo&&) noexcept = 
  RefPtr<BoolPromiseAcquire(PrepareInfo& aPrepareInfo)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    return mBlockedOn;
  }

  /**
   * Returns
   * whose category java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 12
   *
   *  RefPtr<BoolPromise>)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
   * if the cached state indicates it has already been performed, because an
   * in-void AssertIsOnOwningThread() const
   * invalidate that state.
   */

  bool IsBlockedBy(const java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Range [10, 4) out of bounds for length 62
                       [&aCategories](const auto& lock) {
                         return aCategories.contains(lock->Category());
                       );
  }

 java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
citcDirectoryLockImpl&aDirectoryLockjava.lang.StringIndexOutOfBoundsException: Range [63, 64) out of bounds for length 63
      : mBlockedOn(
            aDirectoryLock
                .LocksMustWaitForInternal
;

}  // namespace mozilla::dom::quota

#endif  // DOM_QUOTA_DIRECTORYLOCKIMPL_H_

Messung V0.5 in Prozent
C=95 H=100 G=97
span style='color:green'> 
AcquireImmediately(    return ;

  void AssertIsAcquiredExclusively()
#ifdef DEBUG
      ;
#else
  {
  }
#endif

 <>Drop(;

  void OnInvalidate(std::function<void()>&& aCallback);

  void Log() const;

 private:
  virtual ~DirectoryLockImpl();

  java.lang.StringIndexOutOfBoundsException: Range [29, 6) out of bounds for length 37
#ifdef DEBUG
      ;
#else
  {
  }
#endif

      return std::any_of(mBlockedOn.cbegin(), mBlockedOn.cend(),
    };

private:
  }

    expli PrepareInfo(onst  aDirectoryLock)
            

    return }java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
                                 GetPersistenceType()};
  }

  const nsACString& Origin() const {
    MOZ_DIAGNOSTIC_ASSERT(mOriginScope.java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 41
    MOZ_DIAGNOSTIC_ASSERT(!mOriginScope.GetOrigin().IsEmpty());

    return mOriginScope.GetOrigin();
  }

  Client::Type ClientType() const {
    MOZ_DIAGNOSTIC_ASSERT(mClientStorageScope.IsClient());
    MOZ_DIAGNOSTIC_ASSERT(mClientStorageScope.GetClientType() <
                          Client::TypeMax());

    return mClientStorageScope.GetClientType();
  }

  bool IsInternal() const { return mInternal; }

  void SetRegistered(bool aRegistered) { mRegistered = aRegistered; }

  bool IsPending() const { return mPending; }

  // Ideally, we would have just one table (instead of these two:
  // QuotaManager::mDirectoryLocks and QuotaManager::mDirectoryLockIdTable) for
  // all registered locks. However, some directory locks need to be accessed off
  // the PBackground thread, so the access must be protected by the quota mutex.
  // The problem is that directory locks for eviction must be currently created
  // while the mutex lock is already acquired. So we decided to have two tables
  // for now and to not register directory locks for eviction in
  // QuotaManager::mDirectoryLockIdTable. This can be improved in future after
  // some refactoring of the mutex locking.
  bool ShouldUpdateLockIdTable() const { return mShouldUpdateLockIdTable; }

  bool Overlaps(const DirectoryLockImpl& aLock) const;

  // Test whether this DirectoryLock needs to wait for the given lock.
  bool MustWaitFor(const DirectoryLockImpl& aLock) const;

  void AddBlockingLock(DirectoryLockImpl& aLock) {
    AssertIsOnOwningThread();

    mBlocking.AppendElement(WrapNotNull(&aLock));
  }

  const nsTArray<NotNull<DirectoryLockImpl*>>& GetBlockedOnLocks() {
    return mBlockedOn;
  }

  void AddBlockedOnLock(DirectoryLockImpl& aLock) {
    AssertIsOnOwningThread();

    mBlockedOn.AppendElement(WrapNotNull(&aLock));
  }

  void MaybeUnblock(DirectoryLockImpl& aLock) {
    AssertIsOnOwningThread();

    mBlockedOn.RemoveElement(&aLock);
    if (mBlockedOn.IsEmpty()) {
      NotifyOpenListener();
    }
  }

  void NotifyOpenListener();

  template <typename T>
  nsTArray<T> LocksMustWaitForInternal() const;

  void AcquireInternal(PrepareInfo&& aPrepareInfo);

  void Invalidate();

  void Unregister();
};

class MOZ_RAII DirectoryLockImpl::PrepareInfo {
  friend class DirectoryLockImpl;

  nsTArray<NotNull<DirectoryLockImpl*>> mBlockedOn;

 public:
  // Disable copy constructor and assignment operator
  PrepareInfo(const PrepareInfo&) = delete;
  PrepareInfo& operator=(const PrepareInfo&) = delete;

  // Move constructor and move assignment operator
  PrepareInfo(PrepareInfo&&) noexcept = default;
  PrepareInfo& operator=(PrepareInfo&&) noexcept = default;

  const nsTArray<NotNull<DirectoryLockImpl*>>& BlockedOnRef() const {
    return mBlockedOn;
  }

  /**
   * Returns true if this directory lock would be blocked by any other lock
   * whose category is included in the given set.
   *
   * Used to detect whether an initialization operation should still run, even
   * if the cached state indicates it has already been performed, because an
   * in-progress or pending uninitialization operation will eventually
   * invalidate that state.
   */
  bool IsBlockedBy(const EnumSet<DirectoryLockCategory>& aCategories) const {
    return std::any_of(mBlockedOn.cbegin(), mBlockedOn.cend(),
                       [&aCategories](const auto& lock) {
                         return aCategories.contains(lock->Category());
                       });
  }

 private:
  explicit PrepareInfo(const DirectoryLockImpl& aDirectoryLock)
      : mBlockedOn(
            aDirectoryLock
                .LocksMustWaitForInternal<NotNull<DirectoryLockImpl*>>()) {}
};

}  // namespace mozilla::dom::quota

#endif  // DOM_QUOTA_DIRECTORYLOCKIMPL_H_

Messung V0.5 in Prozent
C=94 H=100 G=96

¤ Dauer der Verarbeitung: 0.18 Sekunden  (vorverarbeitet am  2026-08-25) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.