Fixes bug 77269 "ibench test performance regression" r=gordon, sr=brendan.
git-svn-id: svn://10.0.0.236/trunk@93217 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -106,10 +106,8 @@
|
||||
#include "nsIDocumentCharsetInfo.h"
|
||||
#include "nsIDocumentEncoder.h" //for outputting selection
|
||||
#include "nsIBookmarksService.h"
|
||||
#ifdef MOZ_OLD_CACHE
|
||||
#include "nsINetDataCacheManager.h"
|
||||
#include "nsICachedNetData.h"
|
||||
#endif
|
||||
#include "nsICachingChannel.h"
|
||||
#include "nsICacheEntryDescriptor.h"
|
||||
#include "nsIXMLContent.h" //for createelementNS
|
||||
#include "nsHTMLParts.h" //for createelementNS
|
||||
#include "nsLayoutCID.h"
|
||||
@@ -435,9 +433,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_CACHE
|
||||
nsCOMPtr<nsICachedNetData> cachedData;
|
||||
#endif
|
||||
nsCOMPtr<nsICacheEntryDescriptor> cacheDescriptor;
|
||||
nsresult rv = nsDocument::StartDocumentLoad(aCommand,
|
||||
aChannel, aLoadGroup,
|
||||
aContainer,
|
||||
@@ -539,18 +535,12 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 loadAttr = 0;
|
||||
rv = httpChannel->GetLoadFlags(&loadAttr);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"cannot get load attribute");
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
#ifdef MOZ_OLD_CACHE
|
||||
// copy from nsHTTPChannel.cpp
|
||||
if(loadAttr & nsIChannel::CACHE_AS_FILE)
|
||||
cacheFlags = nsINetDataCacheManager::CACHE_AS_FILE;
|
||||
else if(loadAttr & nsIRequest::INHIBIT_PERSISTENT_CACHING)
|
||||
cacheFlags = nsINetDataCacheManager::BYPASS_PERSISTENT_CACHE;
|
||||
bTryCache = PR_TRUE;
|
||||
#endif
|
||||
nsCOMPtr<nsICachingChannel> cachingChan = do_QueryInterface(httpChannel);
|
||||
if (cachingChan) {
|
||||
nsCOMPtr<nsISupports> cacheToken;
|
||||
cachingChan->GetCacheToken(getter_AddRefs(cacheToken));
|
||||
if (cacheToken)
|
||||
cacheDescriptor = do_QueryInterface(cacheToken);
|
||||
}
|
||||
|
||||
// Don't propogate the result code beyond here, since it
|
||||
@@ -796,31 +786,20 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
}
|
||||
}
|
||||
|
||||
if(bTryCache && urlSpec)
|
||||
if (cacheDescriptor && urlSpec)
|
||||
{
|
||||
#ifdef MOZ_OLD_CACHE
|
||||
nsCOMPtr<nsINetDataCacheManager> cacheMgr;
|
||||
cacheMgr = do_GetService(NS_NETWORK_CACHE_MANAGER_CONTRACTID, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = cacheMgr->GetCachedNetData(urlSpec, nsnull, 0, cacheFlags, getter_AddRefs(cachedData));
|
||||
if(NS_SUCCEEDED(rv)) {
|
||||
if(kCharsetFromCache > charsetSource)
|
||||
{
|
||||
nsXPIDLCString cachedCharset;
|
||||
PRUint32 cachedCharsetLen = 0;
|
||||
rv = cachedData->GetAnnotation( "charset", &cachedCharsetLen,
|
||||
getter_Copies(cachedCharset));
|
||||
if(NS_SUCCEEDED(rv) && (cachedCharsetLen > 0))
|
||||
{
|
||||
charset.AssignWithConversion(cachedCharset);
|
||||
charsetSource = kCharsetFromCache;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rv=NS_OK;
|
||||
#endif
|
||||
if (kCharsetFromCache > charsetSource)
|
||||
{
|
||||
nsXPIDLCString cachedCharset;
|
||||
rv = cacheDescriptor->GetMetaDataElement("charset",
|
||||
getter_Copies(cachedCharset));
|
||||
if (NS_SUCCEEDED(rv) && PL_strlen(cachedCharset) > 0)
|
||||
{
|
||||
charset.AssignWithConversion(cachedCharset);
|
||||
charsetSource = kCharsetFromCache;
|
||||
}
|
||||
}
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
if (kCharsetFromParentFrame > charsetSource) {
|
||||
@@ -885,13 +864,11 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OLD_CACHE
|
||||
if(cachedData) {
|
||||
rv=cachedData->SetAnnotation("charset",charset.Length()+1,
|
||||
if(cacheDescriptor) {
|
||||
rv = cacheDescriptor->SetMetaDataElement("charset",
|
||||
NS_ConvertUCS2toUTF8(charset).get());
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"cannot SetAnnotation");
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),"cannot SetMetaDataElement");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set the parser as the stream listener for the document loader...
|
||||
if (mParser) {
|
||||
|
||||
Reference in New Issue
Block a user