Back to index

lightning-sunbird  0.9+nobinonly
Private Types | Private Member Functions | Private Attributes | Friends
nsCacheRequest Class Reference

#include <nsCacheRequest.h>

Collaboration diagram for nsCacheRequest:
Collaboration graph
[legend]

List of all members.

Private Types

enum  CacheRequestInfo {
  eStoragePolicyMask = 0x000000FF, eStreamBasedMask = 0x00000100, eDoomEntriesIfExpiredMask = 0x00001000, eBlockingModeMask = 0x00010000,
  eWaitingForValidationMask = 0x00100000, eAccessRequestedMask = 0xFF000000
}
 Simple Accessors. More...

Private Member Functions

 nsCacheRequest (nsCString *key, nsICacheListener *listener, nsCacheAccessMode accessRequested, PRBool blockingMode, nsCacheSession *session)
 ~nsCacheRequest ()
void SetAccessRequested (nsCacheAccessMode mode)
nsCacheAccessMode AccessRequested ()
void MarkStreamBased ()
PRBool IsStreamBased ()
void MarkDoomEntriesIfExpired ()
PRBool WillDoomEntriesIfExpired ()
void MarkBlockingMode ()
PRBool IsBlocking ()
PRBool IsNonBlocking ()
void SetStoragePolicy (nsCacheStoragePolicy policy)
nsCacheStoragePolicy StoragePolicy ()
void MarkWaitingForValidation ()
void DoneWaitingForValidation ()
PRBool WaitingForValidation ()
nsresult WaitForValidation (void)
void WakeUp (void)

Private Attributes

nsCStringmKey
 Data members.
PRUint32 mInfo
nsCOMPtr< nsICacheListenermListener
PRThreadmThread
PRLockmLock
PRCondVarmCondVar

Friends

class nsCacheService
class nsCacheEntry

Detailed Description

Definition at line 52 of file nsCacheRequest.h.


Member Enumeration Documentation

Simple Accessors.

Enumerator:
eStoragePolicyMask 
eStreamBasedMask 
eDoomEntriesIfExpiredMask 
eBlockingModeMask 
eWaitingForValidationMask 
eAccessRequestedMask 

Definition at line 92 of file nsCacheRequest.h.

                          {
        eStoragePolicyMask         = 0x000000FF,
        eStreamBasedMask           = 0x00000100,
        eDoomEntriesIfExpiredMask  = 0x00001000,
        eBlockingModeMask          = 0x00010000,
        eWaitingForValidationMask  = 0x00100000,
        eAccessRequestedMask       = 0xFF000000
    };

Constructor & Destructor Documentation

nsCacheRequest::nsCacheRequest ( nsCString key,
nsICacheListener listener,
nsCacheAccessMode  accessRequested,
PRBool  blockingMode,
nsCacheSession session 
) [inline, private]

Definition at line 58 of file nsCacheRequest.h.

Here is the call graph for this function:

nsCacheRequest::~nsCacheRequest ( ) [inline, private]

Definition at line 80 of file nsCacheRequest.h.

Here is the call graph for this function:


Member Function Documentation

Definition at line 108 of file nsCacheRequest.h.

    {
        return (nsCacheAccessMode)((mInfo >> 24) & 0xFF);
    }

Here is the caller graph for this function:

Definition at line 137 of file nsCacheRequest.h.

Here is the caller graph for this function:

PRBool nsCacheRequest::IsBlocking ( ) [inline, private]

Definition at line 121 of file nsCacheRequest.h.

{ return  (mInfo & eBlockingModeMask); }

Here is the caller graph for this function:

PRBool nsCacheRequest::IsNonBlocking ( ) [inline, private]

Definition at line 122 of file nsCacheRequest.h.

{ return !(mInfo & eBlockingModeMask); }
PRBool nsCacheRequest::IsStreamBased ( ) [inline, private]

Definition at line 114 of file nsCacheRequest.h.

{ return (mInfo & eStreamBasedMask) != 0; }

Here is the caller graph for this function:

void nsCacheRequest::MarkBlockingMode ( ) [inline, private]

Definition at line 120 of file nsCacheRequest.h.

Here is the caller graph for this function:

Definition at line 117 of file nsCacheRequest.h.

Here is the caller graph for this function:

void nsCacheRequest::MarkStreamBased ( ) [inline, private]

Definition at line 113 of file nsCacheRequest.h.

Here is the caller graph for this function:

Definition at line 136 of file nsCacheRequest.h.

Here is the caller graph for this function:

Definition at line 101 of file nsCacheRequest.h.

    {
        NS_ASSERTION(mode <= 0xFF, "too many bits in nsCacheAccessMode");
        mInfo &= ~eAccessRequestedMask;
        mInfo |= mode << 24;
    }

Here is the caller graph for this function:

Definition at line 124 of file nsCacheRequest.h.

    {
        NS_ASSERTION(policy <= 0xFF, "too many bits in nsCacheStoragePolicy");
        mInfo &= ~eStoragePolicyMask;  // clear storage policy bits
        mInfo |= policy;         // or in new bits
    }

Here is the caller graph for this function:

Definition at line 131 of file nsCacheRequest.h.

    {
        return (nsCacheStoragePolicy)(mInfo & 0xFF);
    }

Here is the caller graph for this function:

Definition at line 144 of file nsCacheRequest.h.

    {
        if (!WaitingForValidation()) {   // flag already cleared
            MarkWaitingForValidation();  // set up for next time
            return NS_OK;                // early exit;
        }

        if (!mLock) {
            mLock = PR_NewLock();
            if (!mLock) return NS_ERROR_OUT_OF_MEMORY;

            NS_ASSERTION(!mCondVar,"we have mCondVar, but didn't have mLock?");
            mCondVar = PR_NewCondVar(mLock);
            if (!mCondVar) {
                PR_DestroyLock(mLock);
                return NS_ERROR_OUT_OF_MEMORY;
            }
        }
        PRStatus status = PR_SUCCESS;
        PR_Lock(mLock);
        while (WaitingForValidation() && (status == PR_SUCCESS) ) {
            status = PR_WaitCondVar(mCondVar, PR_INTERVAL_NO_TIMEOUT);
        }
        MarkWaitingForValidation();  // set up for next time
        PR_Unlock(mLock);
        
        NS_ASSERTION(status == PR_SUCCESS, "PR_WaitCondVar() returned PR_FAILURE?");
        if (status == PR_FAILURE)
            return NS_ERROR_UNEXPECTED;

        return NS_OK;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 138 of file nsCacheRequest.h.

    {
        return (mInfo & eWaitingForValidationMask) != 0;
    }

Here is the caller graph for this function:

void nsCacheRequest::WakeUp ( void  ) [inline, private]

Definition at line 177 of file nsCacheRequest.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 118 of file nsCacheRequest.h.

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsCacheEntry [friend]

Definition at line 56 of file nsCacheRequest.h.

friend class nsCacheService [friend]

Definition at line 55 of file nsCacheRequest.h.


Member Data Documentation

Definition at line 194 of file nsCacheRequest.h.

Definition at line 190 of file nsCacheRequest.h.

Data members.

Definition at line 189 of file nsCacheRequest.h.

Definition at line 191 of file nsCacheRequest.h.

Definition at line 193 of file nsCacheRequest.h.

Definition at line 192 of file nsCacheRequest.h.


The documentation for this class was generated from the following file: