зеркало из https://github.com/mozilla/pjs.git
bug 54470 Deleting orphaned entries (no record associated with them)
rather than holding them forever in memory on evict. r=neeti sr=rpotts (updating fix from branch 1.28.2.2 to tip)
This commit is contained in:
Родитель
1c77698880
Коммит
1261ac6e1f
|
@ -1063,13 +1063,13 @@ nsCachedNetData::Delete(void)
|
|||
|
||||
// Truncate the content data for a cache entry, so as to make space in the
|
||||
// cache for incoming data for another entry.
|
||||
//
|
||||
// Deals with error case where the underlying recored is non-existent. In such
|
||||
// a situation, we delete the entry.
|
||||
nsresult
|
||||
nsCachedNetData::Evict(PRUint32 aTruncatedContentLength)
|
||||
{
|
||||
nsCOMPtr<nsINetDataCacheRecord> record;
|
||||
nsresult rv = GetRecord(getter_AddRefs(record));
|
||||
if ( NS_FAILED( rv ) ) return rv;
|
||||
if ( record.get() == NULL ) return NS_ERROR_FAILURE;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
// Tell observers about the eviction, so that they can release their
|
||||
// references to this cache object.
|
||||
Notify(nsIStreamAsFileObserver::REQUEST_DELETION, NS_OK);
|
||||
|
@ -1084,8 +1084,16 @@ nsCachedNetData::Evict(PRUint32 aTruncatedContentLength)
|
|||
if (!GetFlag(ALLOW_PARTIAL))
|
||||
aTruncatedContentLength = 0;
|
||||
|
||||
nsresult rv = record->SetStoredContentLength(aTruncatedContentLength);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// Tell the record about the eviction
|
||||
nsCOMPtr<nsINetDataCacheRecord> record;
|
||||
rv = GetRecord(getter_AddRefs(record));
|
||||
|
||||
if (NS_SUCCEEDED(rv) && record)
|
||||
{
|
||||
rv = record->SetStoredContentLength(aTruncatedContentLength);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (aTruncatedContentLength == 0) {
|
||||
SetFlag(VESTIGIAL);
|
||||
|
|
Загрузка…
Ссылка в новой задаче