зеркало из https://github.com/mozilla/gecko-dev.git
Bug 815847 - Part 3: Avoid double-caching XUL prototypes which are loaded at around the same time; r=bsmedberg
This commit is contained in:
Родитель
8bceb50f29
Коммит
8dfd0eb1e5
|
@ -249,12 +249,6 @@ nsXULDocument::~nsXULDocument()
|
|||
NS_IF_RELEASE(kNC_persist);
|
||||
NS_IF_RELEASE(kNC_attribute);
|
||||
NS_IF_RELEASE(kNC_value);
|
||||
|
||||
// Remove the current document here from the table in
|
||||
// case the document did not make it past StartLayout in
|
||||
// ResumeWalk.
|
||||
if (mDocumentURI)
|
||||
nsXULPrototypeCache::GetInstance()->RemoveFromCacheSet(mDocumentURI);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,6 @@ nsXULPrototypeCache::GetPrototype(nsIURI* aURI)
|
|||
}
|
||||
|
||||
mInputStreamTable.Remove(aURI);
|
||||
RemoveFromCacheSet(aURI);
|
||||
return newProto;
|
||||
}
|
||||
|
||||
|
@ -348,12 +347,6 @@ nsXULPrototypeCache::AbortCaching()
|
|||
|
||||
static const char kDisableXULDiskCachePref[] = "nglayout.debug.disable_xul_fastload";
|
||||
|
||||
void
|
||||
nsXULPrototypeCache::RemoveFromCacheSet(nsIURI* aURI)
|
||||
{
|
||||
mCacheURITable.RemoveEntry(aURI);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXULPrototypeCache::WritePrototype(nsXULPrototypeDocument* aPrototypeDocument)
|
||||
{
|
||||
|
@ -361,11 +354,6 @@ nsXULPrototypeCache::WritePrototype(nsXULPrototypeDocument* aPrototypeDocument)
|
|||
|
||||
nsCOMPtr<nsIURI> protoURI = aPrototypeDocument->GetURI();
|
||||
|
||||
// Remove this document from the cache table. We use the table's
|
||||
// emptiness instead of a counter to decide when the caching process
|
||||
// has completed.
|
||||
RemoveFromCacheSet(protoURI);
|
||||
|
||||
nsCOMPtr<nsIObjectOutputStream> oos;
|
||||
rv = GetOutputStream(protoURI, getter_AddRefs(oos));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -457,14 +445,18 @@ nsXULPrototypeCache::FinishOutputStream(nsIURI* uri)
|
|||
&len);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoCString spec(kXULCachePrefix);
|
||||
rv = PathifyURI(uri, spec);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
rv = sc->PutBuffer(spec.get(), buf, len);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mOutputStreamTable.Remove(uri);
|
||||
|
||||
if (!mCacheURITable.GetEntry(uri)) {
|
||||
nsAutoCString spec(kXULCachePrefix);
|
||||
rv = PathifyURI(uri, spec);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
rv = sc->PutBuffer(spec.get(), buf, len);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mOutputStreamTable.Remove(uri);
|
||||
mCacheURITable.RemoveEntry(uri);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,11 +90,6 @@ public:
|
|||
*/
|
||||
nsresult PutStyleSheet(nsCSSStyleSheet* aStyleSheet);
|
||||
|
||||
/**
|
||||
* Remove a XUL document from the set of loading documents.
|
||||
*/
|
||||
void RemoveFromCacheSet(nsIURI* aDocumentURI);
|
||||
|
||||
/**
|
||||
* Write the XUL prototype document to a cache file. The proto must be
|
||||
* fully loaded.
|
||||
|
|
Загрузка…
Ссылка в новой задаче