зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1726714: Remove shutdown state from quota clients. r=dom-storage-reviewers,janv
Depends on D140802 Differential Revision: https://phabricator.services.mozilla.com/D140805
This commit is contained in:
Родитель
81409924e8
Коммит
9b8f88efa9
|
@ -4914,7 +4914,6 @@ class QuotaClient final : public mozilla::dom::quota::Client {
|
|||
RefPtr<nsThreadPool> mMaintenanceThreadPool;
|
||||
nsClassHashtable<nsRefPtrHashKey<DatabaseFileManager>, nsTArray<int64_t>>
|
||||
mPendingDeleteInfos;
|
||||
FlippedOnce<false> mShutdownRequested;
|
||||
|
||||
public:
|
||||
QuotaClient();
|
||||
|
@ -4930,12 +4929,6 @@ class QuotaClient final : public mozilla::dom::quota::Client {
|
|||
return mBackgroundThread;
|
||||
}
|
||||
|
||||
bool IsShuttingDown() const {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
return mShutdownRequested;
|
||||
}
|
||||
|
||||
nsresult AsyncDeleteFile(DatabaseFileManager* aFileManager, int64_t aFileId);
|
||||
|
||||
nsresult FlushPendingFileDeletions();
|
||||
|
@ -12465,7 +12458,7 @@ nsresult QuotaClient::AsyncDeleteFile(DatabaseFileManager* aFileManager,
|
|||
int64_t aFileId) {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
if (mShutdownRequested) {
|
||||
if (IsShuttingDownOnBackgroundThread()) {
|
||||
// Whoops! We want to delete an IndexedDB disk-backed File but it's too late
|
||||
// to actually delete the file! This means we're going to "leak" the file
|
||||
// and leave it around when we shouldn't! (The file will stay around until
|
||||
|
@ -12499,7 +12492,7 @@ nsresult QuotaClient::FlushPendingFileDeletions() {
|
|||
|
||||
nsThreadPool* QuotaClient::GetOrCreateThreadPool() {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(!mShutdownRequested);
|
||||
MOZ_ASSERT(!IsShuttingDownOnBackgroundThread());
|
||||
|
||||
if (!mMaintenanceThreadPool) {
|
||||
RefPtr<nsThreadPool> threadPool = new nsThreadPool();
|
||||
|
@ -12876,7 +12869,10 @@ void QuotaClient::AbortAllOperations() {
|
|||
|
||||
void QuotaClient::StartIdleMaintenance() {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(!mShutdownRequested);
|
||||
if (IsShuttingDownOnBackgroundThread()) {
|
||||
MOZ_ASSERT(false, "!IsShuttingDownOnBackgroundThread()");
|
||||
return;
|
||||
}
|
||||
|
||||
mBackgroundThread = GetCurrentEventTarget();
|
||||
|
||||
|
@ -12886,7 +12882,6 @@ void QuotaClient::StartIdleMaintenance() {
|
|||
|
||||
void QuotaClient::StopIdleMaintenance() {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(!mShutdownRequested);
|
||||
|
||||
if (mCurrentMaintenance) {
|
||||
mCurrentMaintenance->Abort();
|
||||
|
@ -12900,8 +12895,6 @@ void QuotaClient::StopIdleMaintenance() {
|
|||
void QuotaClient::InitiateShutdown() {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
mShutdownRequested.Flip();
|
||||
|
||||
AbortAllOperations();
|
||||
}
|
||||
|
||||
|
|
|
@ -2610,7 +2610,6 @@ class QuotaClient final : public mozilla::dom::quota::Client {
|
|||
static QuotaClient* sInstance;
|
||||
|
||||
Mutex mShadowDatabaseMutex MOZ_UNANNOTATED;
|
||||
bool mShutdownRequested;
|
||||
|
||||
public:
|
||||
QuotaClient();
|
||||
|
@ -2629,12 +2628,6 @@ class QuotaClient final : public mozilla::dom::quota::Client {
|
|||
return mShadowDatabaseMutex;
|
||||
}
|
||||
|
||||
bool IsShuttingDown() const {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
return mShutdownRequested;
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::dom::QuotaClient, override)
|
||||
|
||||
Type GetType() override;
|
||||
|
@ -8312,8 +8305,7 @@ void ArchivedOriginScope::RemoveMatches(
|
|||
QuotaClient* QuotaClient::sInstance = nullptr;
|
||||
|
||||
QuotaClient::QuotaClient()
|
||||
: mShadowDatabaseMutex("LocalStorage mShadowDatabaseMutex"),
|
||||
mShutdownRequested(false) {
|
||||
: mShadowDatabaseMutex("LocalStorage mShadowDatabaseMutex") {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(!sInstance, "We expect this to be a singleton!");
|
||||
|
||||
|
@ -8768,9 +8760,6 @@ void QuotaClient::StartIdleMaintenance() { AssertIsOnBackgroundThread(); }
|
|||
void QuotaClient::StopIdleMaintenance() { AssertIsOnBackgroundThread(); }
|
||||
|
||||
void QuotaClient::InitiateShutdown() {
|
||||
MOZ_ASSERT(!mShutdownRequested);
|
||||
mShutdownRequested = true;
|
||||
|
||||
// gPrepareDatastoreOps are short lived objects running a state machine.
|
||||
// The shutdown flag is checked between states, so we don't have to notify
|
||||
// all the objects here.
|
||||
|
|
|
@ -447,17 +447,9 @@ class CloseOp final : public ConnectionOperationBase {
|
|||
class QuotaClient final : public mozilla::dom::quota::Client {
|
||||
static QuotaClient* sInstance;
|
||||
|
||||
bool mShutdownRequested;
|
||||
|
||||
public:
|
||||
QuotaClient();
|
||||
|
||||
bool IsShuttingDown() const {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
return mShutdownRequested;
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(QuotaClient, override)
|
||||
|
||||
Type GetType() override;
|
||||
|
@ -1623,7 +1615,7 @@ void CloseOp::OnSuccess() {
|
|||
|
||||
QuotaClient* QuotaClient::sInstance = nullptr;
|
||||
|
||||
QuotaClient::QuotaClient() : mShutdownRequested(false) {
|
||||
QuotaClient::QuotaClient() {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(!sInstance, "We expect this to be a singleton!");
|
||||
|
||||
|
@ -1744,9 +1736,6 @@ void QuotaClient::StopIdleMaintenance() { AssertIsOnBackgroundThread(); }
|
|||
|
||||
void QuotaClient::InitiateShutdown() {
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(!mShutdownRequested);
|
||||
|
||||
mShutdownRequested = true;
|
||||
|
||||
if (gOpenConnections) {
|
||||
for (const auto& connection : *gOpenConnections) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче