зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1894995 - Remove deprecated nslCacheEntry methods and their implementations r=valentin,necko-reviewers,places-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D209460
This commit is contained in:
Родитель
af063a188c
Коммит
141fb31205
|
@ -147,7 +147,6 @@ function storeCache(aURL, aContent) {
|
|||
);
|
||||
}
|
||||
os.close();
|
||||
entry.close();
|
||||
resolve();
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1546,26 +1546,6 @@ nsresult CacheEntry::GetAltDataType(nsACString& aType) {
|
|||
return mFile->GetAltDataType(aType);
|
||||
}
|
||||
|
||||
nsresult CacheEntry::MarkValid() {
|
||||
// NOT IMPLEMENTED ACTUALLY
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CacheEntry::MaybeMarkValid() {
|
||||
// NOT IMPLEMENTED ACTUALLY
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CacheEntry::HasWriteAccess(bool aWriteAllowed, bool* aWriteAccess) {
|
||||
*aWriteAccess = aWriteAllowed;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CacheEntry::Close() {
|
||||
// NOT IMPLEMENTED ACTUALLY
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CacheEntry::GetDiskStorageSizeInKB(uint32_t* aDiskStorageSize) {
|
||||
if (NS_FAILED(mFileStatus)) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
|
|
@ -103,10 +103,6 @@ class CacheEntry final : public nsIRunnable,
|
|||
nsresult OpenAlternativeInputStream(const nsACString& type,
|
||||
nsIInputStream** _retval);
|
||||
nsresult GetLoadContextInfo(nsILoadContextInfo** aInfo);
|
||||
nsresult Close(void);
|
||||
nsresult MarkValid(void);
|
||||
nsresult MaybeMarkValid(void);
|
||||
nsresult HasWriteAccess(bool aWriteAllowed, bool* aWriteAccess);
|
||||
|
||||
public:
|
||||
uint32_t GetMetadataMemoryConsumption();
|
||||
|
@ -546,12 +542,6 @@ class CacheEntryHandle final : public nsICacheEntry {
|
|||
nsILoadContextInfo** aLoadContextInfo) override {
|
||||
return mEntry->GetLoadContextInfo(aLoadContextInfo);
|
||||
}
|
||||
NS_IMETHOD Close(void) override { return mEntry->Close(); }
|
||||
NS_IMETHOD MarkValid(void) override { return mEntry->MarkValid(); }
|
||||
NS_IMETHOD MaybeMarkValid(void) override { return mEntry->MaybeMarkValid(); }
|
||||
NS_IMETHOD HasWriteAccess(bool aWriteAllowed, bool* _retval) override {
|
||||
return mEntry->HasWriteAccess(aWriteAllowed, _retval);
|
||||
}
|
||||
|
||||
// Specific implementation:
|
||||
NS_IMETHOD Dismiss() override;
|
||||
|
|
|
@ -309,50 +309,6 @@ interface nsICacheEntry : nsISupports
|
|||
* Get the nsILoadContextInfo of the cache entry
|
||||
*/
|
||||
readonly attribute nsILoadContextInfo loadContextInfo;
|
||||
|
||||
/****************************************************************************
|
||||
* The following methods might be added to some nsICacheEntryInternal
|
||||
* interface since we want to remove them as soon as the old cache backend is
|
||||
* completely removed.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* When the old cache backend is eventually removed, this method
|
||||
* can be removed too.
|
||||
*
|
||||
* In the new backend: this method is no-op
|
||||
* In the old backend: this method delegates to nsICacheEntryDescriptor.close()
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* Marks the entry as valid so that others can use it and get only readonly
|
||||
* access when the entry is held by the 1st writer.
|
||||
*/
|
||||
void markValid();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* FOR BACKWARD COMPATIBILITY ONLY
|
||||
* Marks the entry as valid when write access is acquired.
|
||||
*/
|
||||
void maybeMarkValid();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* FOR BACKWARD COMPATIBILITY ONLY / KINDA HACK
|
||||
* @param aWriteAllowed
|
||||
* Consumer indicates whether write to the entry is allowed for it.
|
||||
* Depends on implementation how the flag is handled.
|
||||
* @returns
|
||||
* true when write access is acquired for this entry,
|
||||
* false otherwise
|
||||
*/
|
||||
boolean hasWriteAccess(in boolean aWriteAllowed);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -955,7 +955,7 @@ nsresult nsHttpChannel::ConnectOnTailUnblock() {
|
|||
// If the content is valid, we should attempt to do so, as technically the
|
||||
// cache has won the race.
|
||||
if (mRaceCacheWithNetwork && mCachedContentIsValid) {
|
||||
Unused << ReadFromCache(true);
|
||||
Unused << ReadFromCache();
|
||||
}
|
||||
|
||||
return TriggerNetwork();
|
||||
|
@ -987,7 +987,7 @@ nsresult nsHttpChannel::ContinueConnect() {
|
|||
LOG((" AsyncCall failed (%08x)", static_cast<uint32_t>(rv)));
|
||||
}
|
||||
}
|
||||
rv = ReadFromCache(true);
|
||||
rv = ReadFromCache();
|
||||
if (NS_FAILED(rv) && event) {
|
||||
event->Revoke();
|
||||
}
|
||||
|
@ -3561,7 +3561,7 @@ nsresult nsHttpChannel::ProcessPartialContent(
|
|||
// the cached content is valid, although incomplete.
|
||||
mCachedContentIsValid = true;
|
||||
return CallOrWaitForResume([aContinueProcessResponseFunc](auto* self) {
|
||||
nsresult rv = self->ReadFromCache(false);
|
||||
nsresult rv = self->ReadFromCache();
|
||||
return aContinueProcessResponseFunc(self, rv);
|
||||
});
|
||||
}
|
||||
|
@ -3702,7 +3702,7 @@ nsresult nsHttpChannel::ProcessNotModified(
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return CallOrWaitForResume([aContinueProcessResponseFunc](auto* self) {
|
||||
nsresult rv = self->ReadFromCache(false);
|
||||
nsresult rv = self->ReadFromCache();
|
||||
return aContinueProcessResponseFunc(self, rv);
|
||||
});
|
||||
}
|
||||
|
@ -4037,7 +4037,6 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, uint32_t* aResult) {
|
|||
rv = OpenCacheInputStream(entry, true);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mCachedContentIsValid = true;
|
||||
entry->MaybeMarkValid();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -4312,10 +4311,6 @@ nsHttpChannel::OnCacheEntryCheck(nsICacheEntry* entry, uint32_t* aResult) {
|
|||
}
|
||||
}
|
||||
|
||||
if (mCachedContentIsValid) {
|
||||
entry->MaybeMarkValid();
|
||||
}
|
||||
|
||||
LOG(
|
||||
("nsHTTPChannel::OnCacheEntryCheck exit [this=%p doValidation=%d "
|
||||
"result=%d]\n",
|
||||
|
@ -4409,7 +4404,7 @@ nsresult nsHttpChannel::OnCacheEntryAvailableInternal(nsICacheEntry* entry,
|
|||
}
|
||||
|
||||
if (mRaceCacheWithNetwork && mCachedContentIsValid) {
|
||||
Unused << ReadFromCache(true);
|
||||
Unused << ReadFromCache();
|
||||
}
|
||||
|
||||
return TriggerNetwork();
|
||||
|
@ -4759,7 +4754,7 @@ nsresult nsHttpChannel::OpenCacheInputStream(nsICacheEntry* cacheEntry,
|
|||
|
||||
// Actually process the cached response that we started to handle in CheckCache
|
||||
// and/or StartBufferingCachedEntity.
|
||||
nsresult nsHttpChannel::ReadFromCache(bool alreadyMarkedValid) {
|
||||
nsresult nsHttpChannel::ReadFromCache(void) {
|
||||
NS_ENSURE_TRUE(mCacheEntry, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mCachedContentIsValid, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(!mCachePump, NS_OK); // already opened
|
||||
|
@ -4825,16 +4820,6 @@ nsresult nsHttpChannel::ReadFromCache(bool alreadyMarkedValid) {
|
|||
// in which case we could have security info from a socket transport.
|
||||
if (!mSecurityInfo) mSecurityInfo = mCachedSecurityInfo;
|
||||
|
||||
if (!alreadyMarkedValid && !LoadCachedContentIsPartial()) {
|
||||
// We validated the entry, and we have write access to the cache, so
|
||||
// mark the cache entry as valid in order to allow others access to
|
||||
// this cache entry.
|
||||
//
|
||||
// TODO: This should be done asynchronously so we don't take the cache
|
||||
// service lock on the main thread.
|
||||
mCacheEntry->MaybeMarkValid();
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
// Keep the conditions below in sync with the conditions in
|
||||
|
@ -8266,12 +8251,12 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
|
|||
|
||||
// perform any final cache operations before we close the cache entry.
|
||||
if (mCacheEntry && LoadRequestTimeInitialized()) {
|
||||
bool writeAccess;
|
||||
// New implementation just returns value of the !LoadCacheEntryIsReadOnly()
|
||||
// flag passed in. Old implementation checks on nsICache::ACCESS_WRITE
|
||||
// flag.
|
||||
mCacheEntry->HasWriteAccess(!LoadCacheEntryIsReadOnly(), &writeAccess);
|
||||
if (writeAccess) {
|
||||
|
||||
// Assume that write access is granted
|
||||
if (!LoadCacheEntryIsReadOnly()) {
|
||||
nsresult rv = FinalizeCacheEntry();
|
||||
if (NS_FAILED(rv)) {
|
||||
LOG(("FinalizeCacheEntry failed (%08x)", static_cast<uint32_t>(rv)));
|
||||
|
|
|
@ -401,7 +401,7 @@ class nsHttpChannel final : public HttpBaseChannel,
|
|||
[[nodiscard]] nsresult UpdateExpirationTime();
|
||||
[[nodiscard]] nsresult CheckPartial(nsICacheEntry* aEntry, int64_t* aSize,
|
||||
int64_t* aContentLength);
|
||||
[[nodiscard]] nsresult ReadFromCache(bool alreadyMarkedValid);
|
||||
[[nodiscard]] nsresult ReadFromCache(void);
|
||||
void CloseCacheEntry(bool doomOnFailure);
|
||||
[[nodiscard]] nsresult InitCacheEntry();
|
||||
void UpdateInhibitPersistentCachingFlag();
|
||||
|
|
|
@ -198,7 +198,6 @@ OpenCallback.prototype = {
|
|||
entry.setValid();
|
||||
}
|
||||
|
||||
entry.close();
|
||||
if (self.behavior & WAITFORWRITE) {
|
||||
self.goon(entry);
|
||||
}
|
||||
|
@ -234,8 +233,6 @@ OpenCallback.prototype = {
|
|||
if (self.behavior & WAITFORWRITE) {
|
||||
self.goon(entry);
|
||||
}
|
||||
|
||||
entry.close();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
@ -255,7 +252,6 @@ OpenCallback.prototype = {
|
|||
self.onDataCheckPassed = true;
|
||||
LOG_C2(self, "entry read done");
|
||||
self.goon(entry);
|
||||
entry.close();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -78,7 +78,6 @@ add_test(function test_304_stored_in_cache() {
|
|||
"HTTP/1.1 304 Not Modified\r\n" + "\r\n"
|
||||
);
|
||||
cacheEntry.metaDataReady();
|
||||
cacheEntry.close();
|
||||
|
||||
var chan = make_channel(baseURI + existingCached304);
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ function open_big_altdata_output(entry) {
|
|||
} catch (e) {
|
||||
Assert.equal(e.result, Cr.NS_ERROR_FILE_TOO_BIG);
|
||||
}
|
||||
entry.close();
|
||||
|
||||
check_entry(write_big_altdata);
|
||||
}
|
||||
|
@ -77,7 +76,6 @@ function write_big_altdata() {
|
|||
Assert.equal(e.result, Cr.NS_ERROR_FILE_TOO_BIG);
|
||||
}
|
||||
os.close();
|
||||
entry.close();
|
||||
|
||||
check_entry(do_test_finished);
|
||||
}
|
||||
|
@ -104,7 +102,6 @@ function check_entry(cb) {
|
|||
pumpReadStream(is, function (read) {
|
||||
Assert.equal(read.length, data.length);
|
||||
is.close();
|
||||
entry.close();
|
||||
|
||||
executeSoon(cb);
|
||||
});
|
||||
|
|
|
@ -62,7 +62,6 @@ var store_data = function (status, entry) {
|
|||
);
|
||||
}
|
||||
os.close();
|
||||
entry.close();
|
||||
store_idx++;
|
||||
executeSoon(store_entries);
|
||||
};
|
||||
|
@ -103,7 +102,6 @@ var check_data = function (status, entry) {
|
|||
Assert.equal(status, Cr.NS_OK);
|
||||
var is = entry.openInputStream(0);
|
||||
pumpReadStream(is, function (read) {
|
||||
entry.close();
|
||||
Assert.equal(read, entries[check_idx][1]);
|
||||
cont();
|
||||
});
|
||||
|
|
|
@ -105,7 +105,6 @@ function storeCache(aCacheEntry, aResponseHeads, aContent) {
|
|||
);
|
||||
}
|
||||
oStream.close();
|
||||
aCacheEntry.close();
|
||||
}
|
||||
|
||||
function test_nocache() {
|
||||
|
|
|
@ -36,7 +36,6 @@ function write_datafile(status, entry) {
|
|||
}
|
||||
|
||||
os.close();
|
||||
entry.close();
|
||||
|
||||
// now change max_entry_size so that the existing entry is too big
|
||||
Services.prefs.setIntPref("browser.cache.disk.max_entry_size", 1024);
|
||||
|
@ -68,8 +67,6 @@ function append_datafile(status, entry) {
|
|||
do_throw();
|
||||
} catch (ex) {}
|
||||
|
||||
entry.close();
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ function write_datafile(status, entry) {
|
|||
write_and_check(os, data, data.length);
|
||||
|
||||
os.close();
|
||||
entry.close();
|
||||
|
||||
// open, doom, append, read
|
||||
asyncOpenCacheEntry(
|
||||
|
@ -59,7 +58,6 @@ function test_read_after_doom(status, entry) {
|
|||
Assert.equal(read.length, 2 * 1024 * 1024);
|
||||
is.close();
|
||||
|
||||
entry.close();
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ function write_datafile(status, entry) {
|
|||
write_and_check(os, data, data.length);
|
||||
|
||||
os.close();
|
||||
entry.close();
|
||||
|
||||
// try to open the entry for appending
|
||||
asyncOpenCacheEntry(
|
||||
|
@ -53,7 +52,6 @@ function open_for_readwrite(status, entry) {
|
|||
// mFD won't be closed in nsDiskCacheStreamIO::Flush().
|
||||
|
||||
os.close();
|
||||
entry.close();
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ TestAppend.prototype = {
|
|||
var os = entry.openOutputStream(0, 5);
|
||||
write_and_check(os, "12345", 5);
|
||||
os.close();
|
||||
entry.close();
|
||||
|
||||
asyncOpenCacheEntry(
|
||||
"http://data/",
|
||||
"disk",
|
||||
|
@ -64,7 +64,6 @@ TestAppend.prototype = {
|
|||
var os = entry.openOutputStream(entry.storageDataSize, 5);
|
||||
write_and_check(os, "abcde", 5);
|
||||
os.close();
|
||||
entry.close();
|
||||
|
||||
asyncOpenCacheEntry(
|
||||
"http://data/",
|
||||
|
@ -81,7 +80,6 @@ TestAppend.prototype = {
|
|||
pumpReadStream(entry.openInputStream(0), function (str) {
|
||||
Assert.equal(str.length, 10);
|
||||
Assert.equal(str, "12345abcde");
|
||||
entry.close();
|
||||
|
||||
executeSoon(self._callback);
|
||||
});
|
||||
|
|
|
@ -49,7 +49,6 @@ function write_entry_cont(entry, ostream) {
|
|||
var data = "testdata";
|
||||
write_and_check(ostream, data, data.length);
|
||||
ostream.close();
|
||||
entry.close();
|
||||
doom("http://testentry/", check_doom1);
|
||||
}
|
||||
|
||||
|
@ -71,13 +70,11 @@ function check_doom2(status) {
|
|||
);
|
||||
}
|
||||
|
||||
var gEntry;
|
||||
var gOstream;
|
||||
function write_entry2(entry, ostream) {
|
||||
// write some data and doom the entry while it is active
|
||||
var data = "testdata";
|
||||
write_and_check(ostream, data, data.length);
|
||||
gEntry = entry;
|
||||
gOstream = ostream;
|
||||
doom("http://testentry/", check_doom3);
|
||||
}
|
||||
|
@ -88,7 +85,6 @@ function check_doom3(status) {
|
|||
var data = "testdata";
|
||||
write_and_check(gOstream, data, data.length);
|
||||
gOstream.close();
|
||||
gEntry.close();
|
||||
// dooming the same entry again should fail
|
||||
doom("http://testentry/", check_doom4);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ function storeCache(aCacheEntry, aResponseHeads, aContent) {
|
|||
);
|
||||
}
|
||||
oStream.close();
|
||||
aCacheEntry.close();
|
||||
}
|
||||
|
||||
function test_partial() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче