mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Issue #2112 - Part 8: Remove Stylo Stylesheet Cache
This commit is contained in:
parent
14764253a5
commit
28cd0ceb47
2 changed files with 17 additions and 49 deletions
|
|
@ -238,8 +238,7 @@ void
|
||||||
nsLayoutStylesheetCache::Shutdown()
|
nsLayoutStylesheetCache::Shutdown()
|
||||||
{
|
{
|
||||||
gCSSLoader = nullptr;
|
gCSSLoader = nullptr;
|
||||||
gStyleCache_Gecko = nullptr;
|
gStyleCache = nullptr;
|
||||||
gStyleCache_Servo = nullptr;
|
|
||||||
MOZ_ASSERT(!gUserContentSheetURL, "Got the URL but never used?");
|
MOZ_ASSERT(!gUserContentSheetURL, "Got the URL but never used?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -354,8 +353,8 @@ nsLayoutStylesheetCache::Get()
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
bool mustInit = !gStyleCache_Gecko && !gStyleCache_Servo;
|
bool mustInit = !gStyleCache;
|
||||||
auto& cache = gStyleCache_Gecko;
|
auto& cache = gStyleCache;
|
||||||
|
|
||||||
if (!cache) {
|
if (!cache) {
|
||||||
cache = new nsLayoutStylesheetCache();
|
cache = new nsLayoutStylesheetCache();
|
||||||
|
|
@ -488,44 +487,23 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
nsLayoutStylesheetCache::InvalidateSheet(RefPtr<StyleSheet>* aGeckoSheet,
|
nsLayoutStylesheetCache::InvalidateSheet(RefPtr<StyleSheet>* aSheet)
|
||||||
RefPtr<StyleSheet>* aServoSheet)
|
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(gCSSLoader, "pref changed before we loaded a sheet?");
|
MOZ_ASSERT(gCSSLoader, "pref changed before we loaded a sheet?");
|
||||||
|
|
||||||
const bool gotGeckoSheet = aGeckoSheet && *aGeckoSheet;
|
// TODO: this redundant check goes away once we get rid of AsGecko.
|
||||||
const bool gotServoSheet = aServoSheet && *aServoSheet;
|
const bool hasSheet = aSheet && *aSheet;
|
||||||
|
if (hasSheet && gCSSLoader) {
|
||||||
// Make sure the URIs match
|
nsIURI* uri = (*aSheet)->GetSheetURI();
|
||||||
MOZ_ASSERT(!gotServoSheet || !gotGeckoSheet ||
|
|
||||||
(*aGeckoSheet)->GetSheetURI() == (*aServoSheet)->GetSheetURI(),
|
|
||||||
"Sheets passed should have the same URI");
|
|
||||||
|
|
||||||
nsIURI* uri;
|
|
||||||
if (gotGeckoSheet) {
|
|
||||||
uri = (*aGeckoSheet)->GetSheetURI();
|
|
||||||
} else if (gotServoSheet) {
|
|
||||||
uri = (*aServoSheet)->GetSheetURI();
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gCSSLoader) {
|
|
||||||
gCSSLoader->ObsoleteSheet(uri);
|
gCSSLoader->ObsoleteSheet(uri);
|
||||||
}
|
*aSheet = nullptr;
|
||||||
if (gotGeckoSheet) {
|
|
||||||
*aGeckoSheet = nullptr;
|
|
||||||
}
|
|
||||||
if (gotServoSheet) {
|
|
||||||
*aServoSheet = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
|
nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(gStyleCache_Gecko || gStyleCache_Servo,
|
MOZ_ASSERT(gStyleCache, "pref changed after shutdown?");
|
||||||
"pref changed after shutdown?");
|
|
||||||
|
|
||||||
// Cause any UA style sheets whose parsing depends on the value of prefs
|
// Cause any UA style sheets whose parsing depends on the value of prefs
|
||||||
// to be re-parsed by dropping the sheet from gCSSLoader's cache
|
// to be re-parsed by dropping the sheet from gCSSLoader's cache
|
||||||
|
|
@ -533,8 +511,7 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
|
||||||
// sheets that are loaded lazily.
|
// sheets that are loaded lazily.
|
||||||
|
|
||||||
#define INVALIDATE(sheet_) \
|
#define INVALIDATE(sheet_) \
|
||||||
InvalidateSheet(gStyleCache_Gecko ? &gStyleCache_Gecko->sheet_ : nullptr, \
|
InvalidateSheet(gStyleCache ? &gStyleCache->sheet_ : nullptr);
|
||||||
gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr);
|
|
||||||
|
|
||||||
// INVALIDATE(mUASheet); // for layout.css.example-pref.enabled
|
// INVALIDATE(mUASheet); // for layout.css.example-pref.enabled
|
||||||
INVALIDATE(mHTMLSheet); // for dom.details_element.enabled
|
INVALIDATE(mHTMLSheet); // for dom.details_element.enabled
|
||||||
|
|
@ -545,13 +522,9 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
|
||||||
/* static */ void
|
/* static */ void
|
||||||
nsLayoutStylesheetCache::InvalidatePreferenceSheets()
|
nsLayoutStylesheetCache::InvalidatePreferenceSheets()
|
||||||
{
|
{
|
||||||
if (gStyleCache_Gecko) {
|
if (gStyleCache) {
|
||||||
gStyleCache_Gecko->mContentPreferenceSheet = nullptr;
|
gStyleCache->mContentPreferenceSheet = nullptr;
|
||||||
gStyleCache_Gecko->mChromePreferenceSheet = nullptr;
|
gStyleCache->mChromePreferenceSheet = nullptr;
|
||||||
}
|
|
||||||
if (gStyleCache_Servo) {
|
|
||||||
gStyleCache_Servo->mContentPreferenceSheet = nullptr;
|
|
||||||
gStyleCache_Servo->mChromePreferenceSheet = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -661,10 +634,7 @@ nsLayoutStylesheetCache::BuildPreferenceSheet(RefPtr<StyleSheet>* aSheet,
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::StaticRefPtr<nsLayoutStylesheetCache>
|
mozilla::StaticRefPtr<nsLayoutStylesheetCache>
|
||||||
nsLayoutStylesheetCache::gStyleCache_Gecko;
|
nsLayoutStylesheetCache::gStyleCache;
|
||||||
|
|
||||||
mozilla::StaticRefPtr<nsLayoutStylesheetCache>
|
|
||||||
nsLayoutStylesheetCache::gStyleCache_Servo;
|
|
||||||
|
|
||||||
mozilla::StaticRefPtr<mozilla::css::Loader>
|
mozilla::StaticRefPtr<mozilla::css::Loader>
|
||||||
nsLayoutStylesheetCache::gCSSLoader;
|
nsLayoutStylesheetCache::gCSSLoader;
|
||||||
|
|
|
||||||
|
|
@ -97,14 +97,12 @@ private:
|
||||||
void LoadSheet(nsIURI* aURI, RefPtr<mozilla::StyleSheet>* aSheet,
|
void LoadSheet(nsIURI* aURI, RefPtr<mozilla::StyleSheet>* aSheet,
|
||||||
mozilla::css::SheetParsingMode aParsingMode,
|
mozilla::css::SheetParsingMode aParsingMode,
|
||||||
mozilla::css::FailureAction aFailureAction);
|
mozilla::css::FailureAction aFailureAction);
|
||||||
static void InvalidateSheet(RefPtr<mozilla::StyleSheet>* aGeckoSheet,
|
static void InvalidateSheet(RefPtr<mozilla::StyleSheet>* aSheet);
|
||||||
RefPtr<mozilla::StyleSheet>* aServoSheet);
|
|
||||||
static void DependentPrefChanged(const char* aPref, void* aData);
|
static void DependentPrefChanged(const char* aPref, void* aData);
|
||||||
void BuildPreferenceSheet(RefPtr<mozilla::StyleSheet>* aSheet,
|
void BuildPreferenceSheet(RefPtr<mozilla::StyleSheet>* aSheet,
|
||||||
nsPresContext* aPresContext);
|
nsPresContext* aPresContext);
|
||||||
|
|
||||||
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Gecko;
|
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache;
|
||||||
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Servo;
|
|
||||||
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader;
|
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader;
|
||||||
static mozilla::StaticRefPtr<nsIURI> gUserContentSheetURL;
|
static mozilla::StaticRefPtr<nsIURI> gUserContentSheetURL;
|
||||||
RefPtr<mozilla::StyleSheet> mChromePreferenceSheet;
|
RefPtr<mozilla::StyleSheet> mChromePreferenceSheet;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue