зеркало из https://github.com/mozilla/pjs.git
[not part of the build] Changes to make the new cache use PRUint32's for
time instead of PRTime's. r=gordon
This commit is contained in:
Родитель
c16959d963
Коммит
22e2760828
|
@ -36,9 +36,10 @@ interface nsIFile;
|
|||
interface nsICacheEntryDescriptor : nsICacheEntryInfo
|
||||
{
|
||||
/**
|
||||
* Set the time at which the cache entry should be considered invalid.
|
||||
* Set the time at which the cache entry should be considered invalid (in
|
||||
* seconds since the Epoch).
|
||||
*/
|
||||
void setExpirationTime(in PRTime expirationTime);
|
||||
void setExpirationTime(in PRUint32 expirationTime);
|
||||
|
||||
/**
|
||||
* Set the cache entry data size. This will fail if the cache entry
|
||||
|
|
|
@ -110,24 +110,24 @@ interface nsICacheEntryInfo : nsISupports
|
|||
readonly attribute long fetchCount;
|
||||
|
||||
/**
|
||||
* Get the last time the cache entry was opened.
|
||||
* Get the last time the cache entry was opened (in seconds since the Epoch).
|
||||
*/
|
||||
readonly attribute PRTime lastFetched;
|
||||
readonly attribute PRUint32 lastFetched;
|
||||
|
||||
/**
|
||||
* Get the last time the cache entry was modified.
|
||||
* Get the last time the cache entry was modified (in seconds since the Epoch).
|
||||
*/
|
||||
readonly attribute PRTime lastModified;
|
||||
readonly attribute PRUint32 lastModified;
|
||||
|
||||
/**
|
||||
* Get the last time the cache entry was marked valid.
|
||||
* Get the last time the cache entry was marked valid (in seconds since the Epoch).
|
||||
*/
|
||||
readonly attribute PRTime lastValidated;
|
||||
readonly attribute PRUint32 lastValidated;
|
||||
|
||||
/**
|
||||
* Get the expiration time of the cache entry.
|
||||
* Get the expiration time of the cache entry (in seconds since the Epoch).
|
||||
*/
|
||||
readonly attribute PRTime expirationTime;
|
||||
readonly attribute PRUint32 expirationTime;
|
||||
|
||||
/**
|
||||
* Get the cache entry data size.
|
||||
|
|
|
@ -117,55 +117,55 @@ nsCacheEntryDescriptor::GetFetchCount(PRInt32 *result)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCacheEntryDescriptor::GetLastFetched(PRTime *result)
|
||||
nsCacheEntryDescriptor::GetLastFetched(PRUint32 *result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
*result = ConvertSecondsToPRTime(mCacheEntry->LastFetched());
|
||||
*result = mCacheEntry->LastFetched();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCacheEntryDescriptor::GetLastModified(PRTime *result)
|
||||
nsCacheEntryDescriptor::GetLastModified(PRUint32 *result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
*result = ConvertSecondsToPRTime(mCacheEntry->LastModified());
|
||||
*result = mCacheEntry->LastModified();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCacheEntryDescriptor::GetLastValidated(PRTime *result)
|
||||
nsCacheEntryDescriptor::GetLastValidated(PRUint32 *result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
*result = ConvertSecondsToPRTime(mCacheEntry->LastValidated());
|
||||
*result = mCacheEntry->LastValidated();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCacheEntryDescriptor::GetExpirationTime(PRTime *result)
|
||||
nsCacheEntryDescriptor::GetExpirationTime(PRUint32 *result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(result);
|
||||
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
*result = ConvertSecondsToPRTime(mCacheEntry->ExpirationTime());
|
||||
*result = mCacheEntry->ExpirationTime();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCacheEntryDescriptor::SetExpirationTime(PRTime expirationTime)
|
||||
nsCacheEntryDescriptor::SetExpirationTime(PRUint32 expirationTime)
|
||||
{
|
||||
if (!mCacheEntry) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
mCacheEntry->SetExpirationTime(ConvertPRTimeToSeconds(expirationTime));
|
||||
mCacheEntry->SetExpirationTime(expirationTime);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,6 @@ nsTransportWrapper::EnsureTransportWithAccess(nsCacheAccessMode mode)
|
|||
}
|
||||
|
||||
if (!mTransport) {
|
||||
nsresult rv;
|
||||
rv = nsCacheService::GlobalInstance()->
|
||||
GetTransportForEntry(descriptor->mCacheEntry,
|
||||
descriptor->mAccessGranted,
|
||||
|
|
|
@ -570,27 +570,27 @@ NS_IMETHODIMP nsCacheEntryInfo::GetFetchCount(PRInt32 *aFetchCount)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetLastFetched(PRTime *aLastFetched)
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetLastFetched(PRUint32 *aLastFetched)
|
||||
{
|
||||
*aLastFetched = ConvertSecondsToPRTime(mMetaDataFile.mLastFetched);
|
||||
*aLastFetched = mMetaDataFile.mLastFetched;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetLastModified(PRTime *aLastModified)
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetLastModified(PRUint32 *aLastModified)
|
||||
{
|
||||
*aLastModified = ConvertSecondsToPRTime(mMetaDataFile.mLastModified);
|
||||
*aLastModified = mMetaDataFile.mLastModified;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetLastValidated(PRTime *aLastValidated)
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetLastValidated(PRUint32 *aLastValidated)
|
||||
{
|
||||
*aLastValidated = ConvertSecondsToPRTime(mMetaDataFile.mLastValidated);
|
||||
*aLastValidated = mMetaDataFile.mLastValidated;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetExpirationTime(PRTime *aExpirationTime)
|
||||
NS_IMETHODIMP nsCacheEntryInfo::GetExpirationTime(PRUint32 *aExpirationTime)
|
||||
{
|
||||
*aExpirationTime = ConvertSecondsToPRTime(mMetaDataFile.mExpirationTime);
|
||||
*aExpirationTime = mMetaDataFile.mExpirationTime;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1371,7 +1371,7 @@ nsresult nsDiskCacheDevice::scanDiskCacheEntries(nsISupportsArray ** result)
|
|||
newCacheSize += dataSize;
|
||||
|
||||
// initially, just sort them by file modification time.
|
||||
PRTime modTime, modTime1;
|
||||
PRUint32 modTime, modTime1;
|
||||
entryInfo->GetLastModified(&modTime);
|
||||
PRUint32 count;
|
||||
entries->Count(&count);
|
||||
|
@ -1388,16 +1388,16 @@ nsresult nsDiskCacheDevice::scanDiskCacheEntries(nsISupportsArray ** result)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
info->GetLastModified(&modTime1);
|
||||
if (low >= high) {
|
||||
if (LL_CMP(modTime, <=, modTime1))
|
||||
if (modTime <= modTime1)
|
||||
rv = entries->InsertElementAt(entryInfo, middle);
|
||||
else
|
||||
rv = entries->InsertElementAt(entryInfo, middle + 1);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
break;
|
||||
} else {
|
||||
if (LL_CMP(modTime, <, modTime1)) {
|
||||
if (modTime < modTime1) {
|
||||
high = middle - 1;
|
||||
} else if (LL_CMP(modTime, >, modTime1)) {
|
||||
} else if (modTime > modTime1) {
|
||||
low = middle + 1;
|
||||
} else {
|
||||
rv = entries->InsertElementAt(entryInfo, middle);
|
||||
|
|
Загрузка…
Ссылка в новой задаче