зеркало из https://github.com/mozilla/pjs.git
[not part of the build] Fixed bugs in HTTP's MOZ_NEW_CACHE build.
This commit is contained in:
Родитель
ec12f3ad59
Коммит
50a762e586
|
@ -836,7 +836,7 @@ nsHTTPChannel::CheckCache()
|
||||||
//if (mLoadAttributes & nsIChannel::CACHE_AS_FILE)
|
//if (mLoadAttributes & nsIChannel::CACHE_AS_FILE)
|
||||||
// mCacheEntry->SetStoragePolicy(nsICache::STORE_ON_DISK_AS_FILE);
|
// mCacheEntry->SetStoragePolicy(nsICache::STORE_ON_DISK_AS_FILE);
|
||||||
//else if (mLoadAttributes & nsIChannel::INHIBIT_PERSISTENT_CACHING)
|
//else if (mLoadAttributes & nsIChannel::INHIBIT_PERSISTENT_CACHING)
|
||||||
mCacheEntry->SetStoragePolicy(nsICache::STORE_IN_MEMORY);
|
// mCacheEntry->SetStoragePolicy(nsICache::STORE_IN_MEMORY);
|
||||||
#else
|
#else
|
||||||
// If this is the first time we've been called for this channel,
|
// If this is the first time we've been called for this channel,
|
||||||
// retrieve an existing cache entry or create a new one.
|
// retrieve an existing cache entry or create a new one.
|
||||||
|
@ -1139,6 +1139,7 @@ nsHTTPChannel::ReadFromCache()
|
||||||
|
|
||||||
// Pump the cache data downstream
|
// Pump the cache data downstream
|
||||||
#ifdef MOZ_NEW_CACHE
|
#ifdef MOZ_NEW_CACHE
|
||||||
|
LOG(("\n>>>> Reading from Cache <<<<\n"));
|
||||||
rv = mCacheTransport->AsyncRead(listener, mResponseContext,
|
rv = mCacheTransport->AsyncRead(listener, mResponseContext,
|
||||||
0, ULONG_MAX, 0,
|
0, ULONG_MAX, 0,
|
||||||
getter_AddRefs(mCacheReadRequest));
|
getter_AddRefs(mCacheReadRequest));
|
||||||
|
@ -1161,6 +1162,9 @@ nsHTTPChannel::CacheAbort(PRUint32 statusCode)
|
||||||
#ifdef MOZ_NEW_CACHE
|
#ifdef MOZ_NEW_CACHE
|
||||||
// Doom the cache entry.
|
// Doom the cache entry.
|
||||||
rv = mCacheEntry->Doom();
|
rv = mCacheEntry->Doom();
|
||||||
|
|
||||||
|
mCacheTransport = 0;
|
||||||
|
mCacheReadRequest = 0;
|
||||||
#else
|
#else
|
||||||
// Set the stored content length to zero
|
// Set the stored content length to zero
|
||||||
rv = mCacheEntry->SetStoredContentLength(0);
|
rv = mCacheEntry->SetStoredContentLength(0);
|
||||||
|
@ -1223,7 +1227,9 @@ nsHTTPChannel::CacheReceivedResponse(nsIStreamListener *aListener,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_NEW_CACHE
|
#ifdef MOZ_NEW_CACHE
|
||||||
NS_ENSURE_TRUE(mCachedContentIsValid == PR_FALSE, NS_OK);
|
//NS_ENSURE_TRUE(mCachedContentIsValid == PR_FALSE, NS_OK);
|
||||||
|
if (mCachedContentIsValid)
|
||||||
|
return NS_OK;
|
||||||
#else
|
#else
|
||||||
// XXX why is this check necessary?
|
// XXX why is this check necessary?
|
||||||
//
|
//
|
||||||
|
@ -1384,6 +1390,8 @@ nsHTTPChannel::CacheReceivedResponse(nsIStreamListener *aListener,
|
||||||
rv = tee->Init(aListener, out);
|
rv = tee->Init(aListener, out);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
LOG(("Preparing to write data into the cache [url=%s]\n", mRequest->Spec()));
|
||||||
|
|
||||||
return CallQueryInterface(tee, aResult);
|
return CallQueryInterface(tee, aResult);
|
||||||
#else
|
#else
|
||||||
rv = mCacheEntry->SetAnnotation("HTTP headers",
|
rv = mCacheEntry->SetAnnotation("HTTP headers",
|
||||||
|
@ -1856,6 +1864,7 @@ nsresult nsHTTPChannel::ResponseCompleted(nsIStreamListener *aListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_NEW_CACHE
|
#ifdef MOZ_NEW_CACHE
|
||||||
|
if (dontCache)
|
||||||
mCacheEntry->Doom();
|
mCacheEntry->Doom();
|
||||||
#else
|
#else
|
||||||
if (dontCache)
|
if (dontCache)
|
||||||
|
@ -2515,6 +2524,7 @@ nsHTTPChannel::ProcessNotModifiedResponse(nsIStreamListener *aListener)
|
||||||
mResponseDataListener = 0/* aListener */;
|
mResponseDataListener = 0/* aListener */;
|
||||||
|
|
||||||
#ifdef MOZ_NEW_CACHE
|
#ifdef MOZ_NEW_CACHE
|
||||||
|
LOG((">>>> Reading from Cache <<<<\n"));
|
||||||
rv = mCacheTransport->AsyncRead(cacheListener, mResponseContext,
|
rv = mCacheTransport->AsyncRead(cacheListener, mResponseContext,
|
||||||
0, ULONG_MAX, 0,
|
0, ULONG_MAX, 0,
|
||||||
getter_AddRefs(mCacheReadRequest));
|
getter_AddRefs(mCacheReadRequest));
|
||||||
|
@ -2835,6 +2845,8 @@ nsHTTPChannel::OnCacheEntryAvailable(nsICacheEntryDescriptor *entry,
|
||||||
LOG(("nsHTTPChannel::OnCacheEntryAvailable [this=%x entry=%x "
|
LOG(("nsHTTPChannel::OnCacheEntryAvailable [this=%x entry=%x "
|
||||||
"access=%x status=%x]\n", this, entry, access, status));
|
"access=%x status=%x]\n", this, entry, access, status));
|
||||||
|
|
||||||
|
LOG(("Got cache entry descriptor: access=%x\n", access));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(status)) {
|
if (NS_SUCCEEDED(status)) {
|
||||||
mCacheEntry = entry;
|
mCacheEntry = entry;
|
||||||
mCacheAccess = access;
|
mCacheAccess = access;
|
||||||
|
|
|
@ -143,12 +143,16 @@ nsHTTPCacheListener::OnStartRequest(nsIRequest *aRequest,
|
||||||
LOG(("nsHTTPCacheListener::OnStartRequest [this=%x]\n", this));
|
LOG(("nsHTTPCacheListener::OnStartRequest [this=%x]\n", this));
|
||||||
mBodyBytesReceived = 0;
|
mBodyBytesReceived = 0;
|
||||||
|
|
||||||
|
#ifdef MOZ_NEW_CACHE
|
||||||
|
mChannel->GetContentLength(&mContentLength);
|
||||||
|
#else
|
||||||
// get and store the content length which will be used in ODA for computing
|
// get and store the content length which will be used in ODA for computing
|
||||||
// progress information.
|
// progress information.
|
||||||
nsCOMPtr<nsIChannel> chan = do_QueryInterface(aRequest);
|
nsCOMPtr<nsIChannel> chan = do_QueryInterface(aRequest);
|
||||||
if (!chan) return NS_ERROR_FAILURE;
|
if (!chan) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
chan->GetContentLength(&mContentLength) ;
|
chan->GetContentLength(&mContentLength) ;
|
||||||
|
#endif
|
||||||
|
|
||||||
return mResponseDataListener->OnStartRequest(mChannel, aContext);
|
return mResponseDataListener->OnStartRequest(mChannel, aContext);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче