зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1514600 - P1 - Notify LS to cleanup the gUsages while storage initialization fails; r=janv
Differential Revision: https://phabricator.services.mozilla.com/D27502 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
79650a7e03
Коммит
a3f0aa60d4
|
@ -2819,6 +2819,8 @@ class QuotaClient final : public mozilla::dom::quota::Client {
|
|||
|
||||
void ReleaseIOThreadObjects() override;
|
||||
|
||||
void OnStorageInitFailed() override;
|
||||
|
||||
void AbortOperations(const nsACString& aOrigin) override;
|
||||
|
||||
void AbortOperationsForProcess(ContentParentId aContentParentId) override;
|
||||
|
@ -8805,6 +8807,14 @@ void QuotaClient::ReleaseIOThreadObjects() {
|
|||
gArchivedOrigins = nullptr;
|
||||
}
|
||||
|
||||
void QuotaClient::OnStorageInitFailed() {
|
||||
AssertIsOnIOThread();
|
||||
MOZ_DIAGNOSTIC_ASSERT(QuotaManager::Get());
|
||||
MOZ_DIAGNOSTIC_ASSERT(!QuotaManager::Get()->IsTemporaryStorageInitialized());
|
||||
|
||||
gUsages = nullptr;
|
||||
}
|
||||
|
||||
void QuotaClient::AbortOperations(const nsACString& aOrigin) {
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
|
|
|
@ -5826,6 +5826,13 @@ nsresult QuotaManager::EnsureTemporaryStorageIsInitialized() {
|
|||
// for whole profile can be collected
|
||||
nsresult statusKeeper = NS_OK;
|
||||
|
||||
AutoTArray<RefPtr<Client>, Client::TYPE_MAX>& clients = mClients;
|
||||
auto autoNotifier = MakeScopeExit([&clients] {
|
||||
for (RefPtr<Client>& client : clients) {
|
||||
client->OnStorageInitFailed();
|
||||
}
|
||||
});
|
||||
|
||||
nsresult rv = InitializeRepository(PERSISTENCE_TYPE_DEFAULT);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
RECORD_IN_NIGHTLY(statusKeeper, rv);
|
||||
|
@ -5878,6 +5885,8 @@ nsresult QuotaManager::EnsureTemporaryStorageIsInitialized() {
|
|||
|
||||
CheckTemporaryStorageLimits();
|
||||
|
||||
autoNotifier.release();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,8 @@ class Client {
|
|||
|
||||
virtual void ReleaseIOThreadObjects() = 0;
|
||||
|
||||
virtual void OnStorageInitFailed(){};
|
||||
|
||||
// Methods which are called on the background thread.
|
||||
virtual void AbortOperations(const nsACString& aOrigin) = 0;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче