зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1563023 - Part 8: Ignore quota cache if the user loads the same profile in different builds; r=asuth
This patch adds support for quota cache invalidation if the profile is loaded in different builds. Differential Revision: https://phabricator.services.mozilla.com/D39673 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3e97ea2f34
Коммит
f4d108788b
|
@ -1840,6 +1840,7 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
bool gInvalidateQuotaCache = false;
|
||||||
StaticAutoPtr<nsString> gBaseDirPath;
|
StaticAutoPtr<nsString> gBaseDirPath;
|
||||||
StaticAutoPtr<nsCString> gBuildId;
|
StaticAutoPtr<nsCString> gBuildId;
|
||||||
|
|
||||||
|
@ -6480,6 +6481,15 @@ nsresult QuotaManager::EnsureStorageIsInitialized() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cacheUsable && gInvalidateQuotaCache) {
|
||||||
|
rv = InvalidateCache(connection);
|
||||||
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
gInvalidateQuotaCache = false;
|
||||||
|
}
|
||||||
|
|
||||||
mStorageConnection = connection;
|
mStorageConnection = connection;
|
||||||
mCacheUsable = cacheUsable;
|
mCacheUsable = cacheUsable;
|
||||||
|
|
||||||
|
@ -7175,6 +7185,11 @@ bool QuotaManager::ParseOrigin(const nsACString& aOrigin, nsCString& aSpec,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void QuotaManager::InvalidateQuotaCache() {
|
||||||
|
gInvalidateQuotaCache = true;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t QuotaManager::LockedCollectOriginsForEviction(
|
uint64_t QuotaManager::LockedCollectOriginsForEviction(
|
||||||
uint64_t aMinSizeToBeFreed, nsTArray<RefPtr<DirectoryLockImpl>>& aLocks) {
|
uint64_t aMinSizeToBeFreed, nsTArray<RefPtr<DirectoryLockImpl>>& aLocks) {
|
||||||
mQuotaMutex.AssertCurrentThreadOwns();
|
mQuotaMutex.AssertCurrentThreadOwns();
|
||||||
|
|
|
@ -430,6 +430,8 @@ class QuotaManager final : public BackgroundThreadObject {
|
||||||
static bool ParseOrigin(const nsACString& aOrigin, nsCString& aSpec,
|
static bool ParseOrigin(const nsACString& aOrigin, nsCString& aSpec,
|
||||||
OriginAttributes* aAttrs);
|
OriginAttributes* aAttrs);
|
||||||
|
|
||||||
|
static void InvalidateQuotaCache();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QuotaManager();
|
QuotaManager();
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@
|
||||||
#include "nsIWidget.h"
|
#include "nsIWidget.h"
|
||||||
#include "nsIDocShell.h"
|
#include "nsIDocShell.h"
|
||||||
#include "nsAppShellCID.h"
|
#include "nsAppShellCID.h"
|
||||||
|
#include "mozilla/dom/quota/QuotaManager.h"
|
||||||
#include "mozilla/scache/StartupCache.h"
|
#include "mozilla/scache/StartupCache.h"
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
|
|
||||||
|
@ -320,6 +321,7 @@ using namespace mozilla::startup;
|
||||||
using mozilla::Unused;
|
using mozilla::Unused;
|
||||||
using mozilla::dom::ContentChild;
|
using mozilla::dom::ContentChild;
|
||||||
using mozilla::dom::ContentParent;
|
using mozilla::dom::ContentParent;
|
||||||
|
using mozilla::dom::quota::QuotaManager;
|
||||||
using mozilla::intl::LocaleService;
|
using mozilla::intl::LocaleService;
|
||||||
using mozilla::scache::StartupCache;
|
using mozilla::scache::StartupCache;
|
||||||
|
|
||||||
|
@ -4170,6 +4172,8 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
|
||||||
bool startupCacheValid = true;
|
bool startupCacheValid = true;
|
||||||
|
|
||||||
if (!cachesOK || !versionOK) {
|
if (!cachesOK || !versionOK) {
|
||||||
|
QuotaManager::InvalidateQuotaCache();
|
||||||
|
|
||||||
startupCacheValid = RemoveComponentRegistries(mProfD, mProfLD, false);
|
startupCacheValid = RemoveComponentRegistries(mProfD, mProfLD, false);
|
||||||
|
|
||||||
// Rewrite compatibility.ini to match the current build. The next run
|
// Rewrite compatibility.ini to match the current build. The next run
|
||||||
|
|
Загрузка…
Ссылка в новой задаче