Don't cache chrome sheets in the CSSLoader. The XUL prototype cache does a

fine job of handling it, and this way the chrome registry only needs to clear
that one cache on skin switches.  Bug 185891, r=sicking, sr=roc+moz
This commit is contained in:
bzbarsky%mit.edu 2003-01-17 04:20:03 +00:00
parent 5059f667b4
commit 7f8f4fdbfc
2 changed files with 42 additions and 34 deletions

View File

@ -1746,10 +1746,6 @@ CSSLoaderImpl::SheetComplete(SheetLoadData* aLoadData, PRBool aSucceeded)
NS_ASSERTION(loadingData == aLoadData, "Broken loading table");
aLoadData->mIsLoading = PR_FALSE;
}
if (aSucceeded) {
mCompleteSheets.Put(&key, aLoadData->mSheet);
}
}
@ -1800,24 +1796,32 @@ CSSLoaderImpl::SheetComplete(SheetLoadData* aLoadData, PRBool aSucceeded)
data = data->mNext;
}
#ifdef INCLUDE_XUL
// Now that it's marked complete, put the sheet in our cache
if (aSucceeded && aLoadData->mURI && IsChromeURI(aLoadData->mURI)) {
nsCOMPtr<nsIXULPrototypeCache> cache(do_GetService("@mozilla.org/xul/xul-prototype-cache;1"));
if (cache) {
PRBool enabled;
cache->GetEnabled(&enabled);
if (enabled) {
nsCOMPtr<nsICSSStyleSheet> sheet;
cache->GetStyleSheet(aLoadData->mURI, getter_AddRefs(sheet));
if (!sheet) {
LOG((" Putting sheet in XUL prototype cache"));
cache->PutStyleSheet(aLoadData->mSheet);
if (aSucceeded && aLoadData->mURI) {
#ifdef INCLUDE_XUL
if (IsChromeURI(aLoadData->mURI)) {
nsCOMPtr<nsIXULPrototypeCache> cache(do_GetService("@mozilla.org/xul/xul-prototype-cache;1"));
if (cache) {
PRBool enabled;
cache->GetEnabled(&enabled);
if (enabled) {
nsCOMPtr<nsICSSStyleSheet> sheet;
cache->GetStyleSheet(aLoadData->mURI, getter_AddRefs(sheet));
if (!sheet) {
LOG((" Putting sheet in XUL prototype cache"));
cache->PutStyleSheet(aLoadData->mSheet);
}
}
}
}
}
else {
#endif
URLKey key(aLoadData->mURI);
mCompleteSheets.Put(&key, aLoadData->mSheet);
#ifdef INCLUDE_XUL
}
#endif
}
NS_RELEASE(aLoadData); // this will release parents and siblings and all that
if (mLoadingDatas.Count() == 0 && mPendingDatas.Count() > 0) {

View File

@ -1746,10 +1746,6 @@ CSSLoaderImpl::SheetComplete(SheetLoadData* aLoadData, PRBool aSucceeded)
NS_ASSERTION(loadingData == aLoadData, "Broken loading table");
aLoadData->mIsLoading = PR_FALSE;
}
if (aSucceeded) {
mCompleteSheets.Put(&key, aLoadData->mSheet);
}
}
@ -1800,24 +1796,32 @@ CSSLoaderImpl::SheetComplete(SheetLoadData* aLoadData, PRBool aSucceeded)
data = data->mNext;
}
#ifdef INCLUDE_XUL
// Now that it's marked complete, put the sheet in our cache
if (aSucceeded && aLoadData->mURI && IsChromeURI(aLoadData->mURI)) {
nsCOMPtr<nsIXULPrototypeCache> cache(do_GetService("@mozilla.org/xul/xul-prototype-cache;1"));
if (cache) {
PRBool enabled;
cache->GetEnabled(&enabled);
if (enabled) {
nsCOMPtr<nsICSSStyleSheet> sheet;
cache->GetStyleSheet(aLoadData->mURI, getter_AddRefs(sheet));
if (!sheet) {
LOG((" Putting sheet in XUL prototype cache"));
cache->PutStyleSheet(aLoadData->mSheet);
if (aSucceeded && aLoadData->mURI) {
#ifdef INCLUDE_XUL
if (IsChromeURI(aLoadData->mURI)) {
nsCOMPtr<nsIXULPrototypeCache> cache(do_GetService("@mozilla.org/xul/xul-prototype-cache;1"));
if (cache) {
PRBool enabled;
cache->GetEnabled(&enabled);
if (enabled) {
nsCOMPtr<nsICSSStyleSheet> sheet;
cache->GetStyleSheet(aLoadData->mURI, getter_AddRefs(sheet));
if (!sheet) {
LOG((" Putting sheet in XUL prototype cache"));
cache->PutStyleSheet(aLoadData->mSheet);
}
}
}
}
}
else {
#endif
URLKey key(aLoadData->mURI);
mCompleteSheets.Put(&key, aLoadData->mSheet);
#ifdef INCLUDE_XUL
}
#endif
}
NS_RELEASE(aLoadData); // this will release parents and siblings and all that
if (mLoadingDatas.Count() == 0 && mPendingDatas.Count() > 0) {