mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset ce8f00cca9dd (bug 1000338) for XPC-2 test failures
This commit is contained in:
parent
7569c3d77f
commit
1986252483
@ -759,11 +759,6 @@ void CacheEntry::InvokeAvailableCallback(Callback const & aCallback)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_SUCCEEDED(mFileStatus)) {
|
|
||||||
// Let the last-fetched and fetch-count properties be updated.
|
|
||||||
mFile->OnFetched();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mIsDoomed || aCallback.mNotWanted) {
|
if (mIsDoomed || aCallback.mNotWanted) {
|
||||||
LOG((" doomed or not wanted, notifying OCEA with NS_ERROR_CACHE_KEY_NOT_FOUND"));
|
LOG((" doomed or not wanted, notifying OCEA with NS_ERROR_CACHE_KEY_NOT_FOUND"));
|
||||||
aCallback.mCallback->OnCacheEntryAvailable(
|
aCallback.mCallback->OnCacheEntryAvailable(
|
||||||
|
@ -910,6 +910,27 @@ CacheFile::GetExpirationTime(uint32_t *_retval)
|
|||||||
return mMetadata->GetExpirationTime(_retval);
|
return mMetadata->GetExpirationTime(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
CacheFile::SetLastModified(uint32_t aLastModified)
|
||||||
|
{
|
||||||
|
CacheFileAutoLock lock(this);
|
||||||
|
MOZ_ASSERT(mMetadata);
|
||||||
|
NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
PostWriteTimer();
|
||||||
|
return mMetadata->SetLastModified(aLastModified);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
CacheFile::GetLastModified(uint32_t *_retval)
|
||||||
|
{
|
||||||
|
CacheFileAutoLock lock(this);
|
||||||
|
MOZ_ASSERT(mMetadata);
|
||||||
|
NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
return mMetadata->GetLastModified(_retval);
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CacheFile::SetFrecency(uint32_t aFrecency)
|
CacheFile::SetFrecency(uint32_t aFrecency)
|
||||||
{
|
{
|
||||||
@ -935,16 +956,6 @@ CacheFile::GetFrecency(uint32_t *_retval)
|
|||||||
return mMetadata->GetFrecency(_retval);
|
return mMetadata->GetFrecency(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
CacheFile::GetLastModified(uint32_t *_retval)
|
|
||||||
{
|
|
||||||
CacheFileAutoLock lock(this);
|
|
||||||
MOZ_ASSERT(mMetadata);
|
|
||||||
NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
|
|
||||||
|
|
||||||
return mMetadata->GetLastModified(_retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CacheFile::GetLastFetched(uint32_t *_retval)
|
CacheFile::GetLastFetched(uint32_t *_retval)
|
||||||
{
|
{
|
||||||
@ -965,18 +976,6 @@ CacheFile::GetFetchCount(uint32_t *_retval)
|
|||||||
return mMetadata->GetFetchCount(_retval);
|
return mMetadata->GetFetchCount(_retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
CacheFile::OnFetched()
|
|
||||||
{
|
|
||||||
CacheFileAutoLock lock(this);
|
|
||||||
MOZ_ASSERT(mMetadata);
|
|
||||||
NS_ENSURE_TRUE(mMetadata, NS_ERROR_UNEXPECTED);
|
|
||||||
|
|
||||||
PostWriteTimer();
|
|
||||||
|
|
||||||
return mMetadata->OnFetched();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CacheFile::Lock()
|
CacheFile::Lock()
|
||||||
{
|
{
|
||||||
|
@ -90,14 +90,12 @@ public:
|
|||||||
nsresult ElementsSize(uint32_t *_retval);
|
nsresult ElementsSize(uint32_t *_retval);
|
||||||
nsresult SetExpirationTime(uint32_t aExpirationTime);
|
nsresult SetExpirationTime(uint32_t aExpirationTime);
|
||||||
nsresult GetExpirationTime(uint32_t *_retval);
|
nsresult GetExpirationTime(uint32_t *_retval);
|
||||||
|
nsresult SetLastModified(uint32_t aLastModified);
|
||||||
|
nsresult GetLastModified(uint32_t *_retval);
|
||||||
nsresult SetFrecency(uint32_t aFrecency);
|
nsresult SetFrecency(uint32_t aFrecency);
|
||||||
nsresult GetFrecency(uint32_t *_retval);
|
nsresult GetFrecency(uint32_t *_retval);
|
||||||
nsresult GetLastModified(uint32_t *_retval);
|
|
||||||
nsresult GetLastFetched(uint32_t *_retval);
|
nsresult GetLastFetched(uint32_t *_retval);
|
||||||
nsresult GetFetchCount(uint32_t *_retval);
|
nsresult GetFetchCount(uint32_t *_retval);
|
||||||
// Called by upper layers to indicated the entry has been fetched,
|
|
||||||
// i.e. delivered to the consumer.
|
|
||||||
nsresult OnFetched();
|
|
||||||
|
|
||||||
bool DataSize(int64_t* aSize);
|
bool DataSize(int64_t* aSize);
|
||||||
void Key(nsACString& aKey) { aKey = mKey; }
|
void Key(nsACString& aKey) { aKey = mKey; }
|
||||||
|
@ -27,8 +27,6 @@ namespace net {
|
|||||||
|
|
||||||
#define kCacheEntryVersion 1
|
#define kCacheEntryVersion 1
|
||||||
|
|
||||||
#define NOW_SECONDS() (uint32_t(PR_Now() / PR_USEC_PER_SEC))
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(CacheFileMetadata, CacheFileIOListener)
|
NS_IMPL_ISUPPORTS(CacheFileMetadata, CacheFileIOListener)
|
||||||
|
|
||||||
CacheFileMetadata::CacheFileMetadata(CacheFileHandle *aHandle, const nsACString &aKey)
|
CacheFileMetadata::CacheFileMetadata(CacheFileHandle *aHandle, const nsACString &aKey)
|
||||||
@ -84,6 +82,7 @@ CacheFileMetadata::CacheFileMetadata(bool aMemoryOnly, const nsACString &aKey)
|
|||||||
memset(&mMetaHdr, 0, sizeof(CacheFileMetadataHeader));
|
memset(&mMetaHdr, 0, sizeof(CacheFileMetadataHeader));
|
||||||
mMetaHdr.mVersion = kCacheEntryVersion;
|
mMetaHdr.mVersion = kCacheEntryVersion;
|
||||||
mMetaHdr.mExpirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
|
mMetaHdr.mExpirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
|
||||||
|
mMetaHdr.mFetchCount = 1;
|
||||||
mKey = aKey;
|
mKey = aKey;
|
||||||
mMetaHdr.mKeySize = mKey.Length();
|
mMetaHdr.mKeySize = mKey.Length();
|
||||||
|
|
||||||
@ -505,7 +504,7 @@ CacheFileMetadata::SetExpirationTime(uint32_t aExpirationTime)
|
|||||||
LOG(("CacheFileMetadata::SetExpirationTime() [this=%p, expirationTime=%d]",
|
LOG(("CacheFileMetadata::SetExpirationTime() [this=%p, expirationTime=%d]",
|
||||||
this, aExpirationTime));
|
this, aExpirationTime));
|
||||||
|
|
||||||
MarkDirty(false);
|
MarkDirty();
|
||||||
mMetaHdr.mExpirationTime = aExpirationTime;
|
mMetaHdr.mExpirationTime = aExpirationTime;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -517,13 +516,31 @@ CacheFileMetadata::GetExpirationTime(uint32_t *_retval)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
CacheFileMetadata::SetLastModified(uint32_t aLastModified)
|
||||||
|
{
|
||||||
|
LOG(("CacheFileMetadata::SetLastModified() [this=%p, lastModified=%d]",
|
||||||
|
this, aLastModified));
|
||||||
|
|
||||||
|
MarkDirty();
|
||||||
|
mMetaHdr.mLastModified = aLastModified;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
CacheFileMetadata::GetLastModified(uint32_t *_retval)
|
||||||
|
{
|
||||||
|
*_retval = mMetaHdr.mLastModified;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CacheFileMetadata::SetFrecency(uint32_t aFrecency)
|
CacheFileMetadata::SetFrecency(uint32_t aFrecency)
|
||||||
{
|
{
|
||||||
LOG(("CacheFileMetadata::SetFrecency() [this=%p, frecency=%f]",
|
LOG(("CacheFileMetadata::SetFrecency() [this=%p, frecency=%f]",
|
||||||
this, (double)aFrecency));
|
this, (double)aFrecency));
|
||||||
|
|
||||||
MarkDirty(false);
|
MarkDirty();
|
||||||
mMetaHdr.mFrecency = aFrecency;
|
mMetaHdr.mFrecency = aFrecency;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -535,13 +552,6 @@ CacheFileMetadata::GetFrecency(uint32_t *_retval)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
CacheFileMetadata::GetLastModified(uint32_t *_retval)
|
|
||||||
{
|
|
||||||
*_retval = mMetaHdr.mLastModified;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CacheFileMetadata::GetLastFetched(uint32_t *_retval)
|
CacheFileMetadata::GetLastFetched(uint32_t *_retval)
|
||||||
{
|
{
|
||||||
@ -556,25 +566,6 @@ CacheFileMetadata::GetFetchCount(uint32_t *_retval)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
CacheFileMetadata::OnFetched()
|
|
||||||
{
|
|
||||||
MarkDirty(false);
|
|
||||||
|
|
||||||
mMetaHdr.mLastFetched = NOW_SECONDS();
|
|
||||||
++mMetaHdr.mFetchCount;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
CacheFileMetadata::MarkDirty(bool aUpdateLastModified)
|
|
||||||
{
|
|
||||||
mIsDirty = true;
|
|
||||||
if (aUpdateLastModified) {
|
|
||||||
mMetaHdr.mLastModified = NOW_SECONDS();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CacheFileMetadata::OnFileOpened(CacheFileHandle *aHandle, nsresult aResult)
|
CacheFileMetadata::OnFileOpened(CacheFileHandle *aHandle, nsresult aResult)
|
||||||
{
|
{
|
||||||
@ -730,7 +721,7 @@ CacheFileMetadata::InitEmptyMetadata()
|
|||||||
}
|
}
|
||||||
mOffset = 0;
|
mOffset = 0;
|
||||||
mMetaHdr.mVersion = kCacheEntryVersion;
|
mMetaHdr.mVersion = kCacheEntryVersion;
|
||||||
mMetaHdr.mFetchCount = 0;
|
mMetaHdr.mFetchCount = 1;
|
||||||
mMetaHdr.mExpirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
|
mMetaHdr.mExpirationTime = nsICacheEntry::NO_EXPIRATION_TIME;
|
||||||
mMetaHdr.mKeySize = mKey.Length();
|
mMetaHdr.mKeySize = mKey.Length();
|
||||||
|
|
||||||
@ -841,6 +832,7 @@ CacheFileMetadata::ParseMetadata(uint32_t aMetaOffset, uint32_t aBufOffset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mMetaHdr.mFetchCount++;
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
|
|
||||||
mElementsSize = metaposOffset - elementsOffset;
|
mElementsSize = metaposOffset - elementsOffset;
|
||||||
|
@ -138,18 +138,16 @@ public:
|
|||||||
|
|
||||||
nsresult SetExpirationTime(uint32_t aExpirationTime);
|
nsresult SetExpirationTime(uint32_t aExpirationTime);
|
||||||
nsresult GetExpirationTime(uint32_t *_retval);
|
nsresult GetExpirationTime(uint32_t *_retval);
|
||||||
|
nsresult SetLastModified(uint32_t aLastModified);
|
||||||
|
nsresult GetLastModified(uint32_t *_retval);
|
||||||
nsresult SetFrecency(uint32_t aFrecency);
|
nsresult SetFrecency(uint32_t aFrecency);
|
||||||
nsresult GetFrecency(uint32_t *_retval);
|
nsresult GetFrecency(uint32_t *_retval);
|
||||||
nsresult GetLastModified(uint32_t *_retval);
|
|
||||||
nsresult GetLastFetched(uint32_t *_retval);
|
nsresult GetLastFetched(uint32_t *_retval);
|
||||||
nsresult GetFetchCount(uint32_t *_retval);
|
nsresult GetFetchCount(uint32_t *_retval);
|
||||||
// Called by upper layers to indicate the entry this metadata belongs
|
|
||||||
// with has been fetched, i.e. delivered to the consumer.
|
|
||||||
nsresult OnFetched();
|
|
||||||
|
|
||||||
int64_t Offset() { return mOffset; }
|
int64_t Offset() { return mOffset; }
|
||||||
uint32_t ElementsSize() { return mElementsSize; }
|
uint32_t ElementsSize() { return mElementsSize; }
|
||||||
void MarkDirty(bool aUpdateLastModified = true);
|
void MarkDirty() { mIsDirty = true; }
|
||||||
bool IsDirty() { return mIsDirty; }
|
bool IsDirty() { return mIsDirty; }
|
||||||
uint32_t MemoryUsage() { return sizeof(CacheFileMetadata) + mHashArraySize + mBufSize; }
|
uint32_t MemoryUsage() { return sizeof(CacheFileMetadata) + mHashArraySize + mBufSize; }
|
||||||
|
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
function run_test()
|
|
||||||
{
|
|
||||||
do_get_profile();
|
|
||||||
function NowSeconds() {
|
|
||||||
return parseInt((new Date()).getTime() / 1000);
|
|
||||||
}
|
|
||||||
function do_check_time(t, min, max) {
|
|
||||||
do_check_true(t >= min);
|
|
||||||
do_check_true(t <= max);
|
|
||||||
}
|
|
||||||
|
|
||||||
var timeStart = NowSeconds();
|
|
||||||
|
|
||||||
asyncOpenCacheEntry("http://t/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
|
||||||
new OpenCallback(NEW, "m", "d", function(entry) {
|
|
||||||
|
|
||||||
var firstOpen = NowSeconds();
|
|
||||||
do_check_eq(entry.fetchCount, 1);
|
|
||||||
do_check_time(entry.lastFetched, timeStart, firstOpen);
|
|
||||||
do_check_time(entry.lastModified, timeStart, firstOpen);
|
|
||||||
|
|
||||||
do_timeout(2000, () => {
|
|
||||||
asyncOpenCacheEntry("http://t/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null,
|
|
||||||
new OpenCallback(NORMAL, "m", "d", function(entry) {
|
|
||||||
|
|
||||||
var secondOpen = NowSeconds();
|
|
||||||
do_check_eq(entry.fetchCount, 2);
|
|
||||||
do_check_time(entry.lastFetched, firstOpen, secondOpen);
|
|
||||||
do_check_time(entry.lastModified, timeStart, firstOpen);
|
|
||||||
|
|
||||||
finish_cache2_test();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
do_test_pending();
|
|
||||||
}
|
|
@ -59,7 +59,6 @@ support-files =
|
|||||||
# GC, that this patch is dependent on, doesn't work well on Android.
|
# GC, that this patch is dependent on, doesn't work well on Android.
|
||||||
skip-if = os == "android"
|
skip-if = os == "android"
|
||||||
[test_cache2-27-force-valid-for.js]
|
[test_cache2-27-force-valid-for.js]
|
||||||
[test_cache2-28-last-access-attrs.js]
|
|
||||||
[test_304_responses.js]
|
[test_304_responses.js]
|
||||||
[test_cacheForOfflineUse_no-store.js]
|
[test_cacheForOfflineUse_no-store.js]
|
||||||
[test_307_redirect.js]
|
[test_307_redirect.js]
|
||||||
|
Loading…
Reference in New Issue
Block a user