Bug 1904562 - Change DirectoryLockImpl to be topmost class; r=dom-storage-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D214857
This commit is contained in:
Jan Varga 2024-10-21 09:31:27 +00:00
parent d2fa871ccb
commit e79a4c2ad5
10 changed files with 31 additions and 23 deletions

View File

@ -16,6 +16,7 @@
#include "mozilla/dom/cache/ManagerId.h"
#include "mozilla/dom/quota/Assertions.h"
#include "mozilla/dom/quota/ClientDirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockInlines.h"
#include "mozilla/dom/quota/PrincipalUtils.h"
#include "mozilla/dom/quota/QuotaManager.h"

View File

@ -27,6 +27,7 @@
#include "mozilla/dom/QMResult.h"
#include "mozilla/dom/quota/ClientDirectoryLock.h"
#include "mozilla/dom/quota/ClientImpl.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockInlines.h"
#include "mozilla/dom/quota/HashKeys.h"
#include "mozilla/dom/quota/QuotaCommon.h"

View File

@ -125,6 +125,7 @@
#include "mozilla/dom/quota/ClientDirectoryLock.h"
#include "mozilla/dom/quota/ClientImpl.h"
#include "mozilla/dom/quota/DebugOnlyMacro.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockInlines.h"
#include "mozilla/dom/quota/DecryptingInputStream_impl.h"
#include "mozilla/dom/quota/EncryptingOutputStream_impl.h"

View File

@ -77,6 +77,7 @@
#include "mozilla/dom/quota/Client.h"
#include "mozilla/dom/quota/ClientDirectoryLock.h"
#include "mozilla/dom/quota/ClientImpl.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockInlines.h"
#include "mozilla/dom/quota/FirstInitializationAttemptsImpl.h"
#include "mozilla/dom/quota/HashKeys.h"

View File

@ -35,6 +35,8 @@ class PersistenceScope;
// Basic directory lock interface shared by all other directory lock classes.
// The class must contain pure virtual functions only to avoid problems with
// multiple inheritance.
//
// XXX Unused, remove this class.
class NS_NO_VTABLE DirectoryLock {
public:
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING

View File

@ -77,11 +77,12 @@ bool DirectoryLockImpl::MustWait() const {
return false;
}
nsTArray<RefPtr<DirectoryLock>> DirectoryLockImpl::LocksMustWaitFor() const {
nsTArray<RefPtr<DirectoryLockImpl>> DirectoryLockImpl::LocksMustWaitFor()
const {
AssertIsOnOwningThread();
MOZ_ASSERT(!mRegistered);
nsTArray<RefPtr<DirectoryLock>> locks;
nsTArray<RefPtr<DirectoryLockImpl>> locks;
for (DirectoryLockImpl* const existingLock : mQuotaManager->mDirectoryLocks) {
if (MustWaitFor(*existingLock)) {

View File

@ -21,7 +21,6 @@
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/quota/Client.h"
#include "mozilla/dom/quota/CommonMetadata.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockCategory.h"
#include "mozilla/dom/quota/ForwardDecls.h"
#include "mozilla/dom/quota/OriginScope.h"
@ -38,7 +37,8 @@ class QuotaManager;
enum class ShouldUpdateLockIdTableFlag { No, Yes };
class DirectoryLockImpl : public DirectoryLock {
// XXX Rename to DirectoryLockBase.
class DirectoryLockImpl {
friend class ClientDirectoryLock;
friend class OriginDirectoryLock;
friend class QuotaManager;
@ -85,39 +85,37 @@ class DirectoryLockImpl : public DirectoryLock {
ShouldUpdateLockIdTableFlag aShouldUpdateLockIdTableFlag,
DirectoryLockCategory aCategory);
// DirectoryLock interface
NS_INLINE_DECL_REFCOUNTING(DirectoryLockImpl)
NS_INLINE_DECL_REFCOUNTING(DirectoryLockImpl, override)
int64_t Id() const { return mId; }
int64_t Id() const override { return mId; }
const PersistenceScope& PersistenceScopeRef() const override {
const PersistenceScope& PersistenceScopeRef() const {
return mPersistenceScope;
}
const OriginScope& GetOriginScope() const override { return mOriginScope; }
const OriginScope& GetOriginScope() const { return mOriginScope; }
const Nullable<Client::Type>& NullableClientType() const override {
const Nullable<Client::Type>& NullableClientType() const {
return mClientType;
}
DirectoryLockCategory Category() const override { return mCategory; }
DirectoryLockCategory Category() const { return mCategory; }
bool Acquired() const override { return mAcquired; }
bool Acquired() const { return mAcquired; }
bool MustWait() const override;
bool MustWait() const;
nsTArray<RefPtr<DirectoryLock>> LocksMustWaitFor() const override;
nsTArray<RefPtr<DirectoryLockImpl>> LocksMustWaitFor() const;
bool Invalidated() const override { return mInvalidated; }
bool Invalidated() const { return mInvalidated; }
bool Dropped() const override { return mDropped; }
bool Dropped() const { return mDropped; }
RefPtr<BoolPromise> Acquire() override;
RefPtr<BoolPromise> Acquire();
void AcquireImmediately() override;
void AcquireImmediately();
void AssertIsAcquiredExclusively() override
void AssertIsAcquiredExclusively()
#ifdef DEBUG
;
#else
@ -125,11 +123,11 @@ class DirectoryLockImpl : public DirectoryLock {
}
#endif
RefPtr<BoolPromise> Drop() override;
RefPtr<BoolPromise> Drop();
void OnInvalidate(std::function<void()>&& aCallback) override;
void OnInvalidate(std::function<void()>&& aCallback);
void Log() const override;
void Log() const;
private:
virtual ~DirectoryLockImpl();

View File

@ -11,6 +11,7 @@
#include "mozilla/MozPromise.h"
#include "mozilla/SpinEventLoopUntil.h"
#include "mozilla/dom/quota/ClientDirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockInlines.h"
#include "mozilla/dom/quota/ForwardDecls.h"
#include "mozilla/dom/quota/QuotaManager.h"

View File

@ -8,6 +8,7 @@
#include "mozilla/BasePrincipal.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
#include "mozilla/dom/quota/ClientDirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockInlines.h"
#include "mozilla/dom/quota/OriginScope.h"
#include "mozilla/dom/quota/PersistenceScope.h"

View File

@ -37,6 +37,7 @@
#include "mozilla/dom/quota/Client.h"
#include "mozilla/dom/quota/ClientDirectoryLock.h"
#include "mozilla/dom/quota/ClientImpl.h"
#include "mozilla/dom/quota/DirectoryLock.h"
#include "mozilla/dom/quota/DirectoryLockInlines.h"
#include "mozilla/dom/quota/FileStreams.h"
#include "mozilla/dom/quota/PrincipalUtils.h"