Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsDiskCacheEntry Struct Reference

#include <nsDiskCacheEntry.h>

List of all members.

Public Member Functions

PRUint32 Size ()
nsCacheEntryCreateCacheEntry (nsCacheDevice *device)
 CreateCacheEntry()
PRBool CheckConsistency (PRUint32 size)
 CheckConsistency()
void Swap ()
void Unswap ()

Public Attributes

PRUint32 mHeaderVersion
PRUint32 mMetaLocation
PRInt32 mFetchCount
PRUint32 mLastFetched
PRUint32 mLastModified
PRUint32 mExpirationTime
PRUint32 mDataSize
PRUint32 mKeySize
PRUint32 mMetaDataSize
char mKeyStart [1]

Detailed Description

Definition at line 60 of file nsDiskCacheEntry.h.


Member Function Documentation

CheckConsistency()

Perform a few simple checks to verify the data looks reasonable.

Definition at line 95 of file nsDiskCacheEntry.cpp.

{
    if ((mHeaderVersion != nsDiskCache::kCurrentVersion) ||
        (Size() > size) ||
        (mKeySize == 0) ||
        (mKeyStart[mKeySize - 1] != 0)) // key is null terminated
        return PR_FALSE;
    
    return PR_TRUE;
}

Here is the call graph for this function:

CreateCacheEntry()

Creates an nsCacheEntry and sets all fields except for the binding.

Definition at line 61 of file nsDiskCacheEntry.cpp.

{
    nsCacheEntry * entry = nsnull;
    nsresult       rv = nsCacheEntry::Create(mKeyStart,
                                             nsICache::STREAM_BASED,
                                             nsICache::STORE_ON_DISK,
                                             device,
                                             &entry);
    if (NS_FAILED(rv) || !entry) return nsnull;
    
    entry->SetFetchCount(mFetchCount);
    entry->SetLastFetched(mLastFetched);
    entry->SetLastModified(mLastModified);
    entry->SetExpirationTime(mExpirationTime);
    entry->SetCacheDevice(device);
    // XXX why does nsCacheService have to fill out device in BindEntry()?
    entry->SetDataSize(mDataSize);
    
    rv = entry->UnflattenMetaData(&mKeyStart[mKeySize], mMetaDataSize);
    if (NS_FAILED(rv)) {
        delete entry;
        return nsnull;
    }
    
    return entry;                      
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 73 of file nsDiskCacheEntry.h.

Here is the caller graph for this function:

Definition at line 81 of file nsDiskCacheEntry.h.

    {
#if defined(IS_LITTLE_ENDIAN)   
        mHeaderVersion      = ::PR_htonl(mHeaderVersion);
        mMetaLocation       = ::PR_htonl(mMetaLocation);
        mFetchCount         = ::PR_htonl(mFetchCount);
        mLastFetched        = ::PR_htonl(mLastFetched);
        mLastModified       = ::PR_htonl(mLastModified);
        mExpirationTime     = ::PR_htonl(mExpirationTime);
        mDataSize           = ::PR_htonl(mDataSize);
        mKeySize            = ::PR_htonl(mKeySize);
        mMetaDataSize       = ::PR_htonl(mMetaDataSize);
#endif
    }

Here is the caller graph for this function:

Definition at line 96 of file nsDiskCacheEntry.h.

    {
#if defined(IS_LITTLE_ENDIAN)
        mHeaderVersion      = ::PR_ntohl(mHeaderVersion);
        mMetaLocation       = ::PR_ntohl(mMetaLocation);
        mFetchCount         = ::PR_ntohl(mFetchCount);
        mLastFetched        = ::PR_ntohl(mLastFetched);
        mLastModified       = ::PR_ntohl(mLastModified);
        mExpirationTime     = ::PR_ntohl(mExpirationTime);
        mDataSize           = ::PR_ntohl(mDataSize);
        mKeySize            = ::PR_ntohl(mKeySize);
        mMetaDataSize       = ::PR_ntohl(mMetaDataSize);
#endif
    }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 67 of file nsDiskCacheEntry.h.

Definition at line 66 of file nsDiskCacheEntry.h.

Definition at line 63 of file nsDiskCacheEntry.h.

Definition at line 61 of file nsDiskCacheEntry.h.

Definition at line 68 of file nsDiskCacheEntry.h.

Definition at line 70 of file nsDiskCacheEntry.h.

Definition at line 64 of file nsDiskCacheEntry.h.

Definition at line 65 of file nsDiskCacheEntry.h.

Definition at line 69 of file nsDiskCacheEntry.h.

Definition at line 62 of file nsDiskCacheEntry.h.


The documentation for this struct was generated from the following files: