Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
nsCacheEntryHashTable Class Reference

#include <nsCacheEntry.h>

Collaboration diagram for nsCacheEntryHashTable:
Collaboration graph
[legend]

List of all members.

Classes

class  Visitor

Public Member Functions

 nsCacheEntryHashTable ()
 ~nsCacheEntryHashTable ()
nsresult Init ()
void Shutdown ()
nsCacheEntryGetEntry (const nsCString *key)
nsresult AddEntry (nsCacheEntry *entry)
void RemoveEntry (nsCacheEntry *entry)
void VisitEntries (Visitor *visitor)

Static Private Member Functions

static const void *PR_CALLBACK GetKey (PLDHashTable *table, PLDHashEntryHdr *entry)
 hash table operation callback functions
static PLDHashNumber PR_CALLBACK HashKey (PLDHashTable *table, const void *key)
static PRBool PR_CALLBACK MatchEntry (PLDHashTable *table, const PLDHashEntryHdr *entry, const void *key)
static void PR_CALLBACK MoveEntry (PLDHashTable *table, const PLDHashEntryHdr *from, PLDHashEntryHdr *to)
static void PR_CALLBACK ClearEntry (PLDHashTable *table, PLDHashEntryHdr *entry)
static void PR_CALLBACK Finalize (PLDHashTable *table)
static PLDHashOperator PR_CALLBACK FreeCacheEntries (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
static PLDHashOperator PR_CALLBACK VisitEntry (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)

Private Attributes

PLDHashTable table
PRBool initialized

Static Private Attributes

static PLDHashTableOps ops

Friends

class nsCacheService

Detailed Description

Definition at line 281 of file nsCacheEntry.h.


Constructor & Destructor Documentation

Definition at line 408 of file nsCacheEntry.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 456 of file nsCacheEntry.cpp.

{
    PLDHashEntryHdr    *hashEntry;

    NS_ASSERTION(initialized, "nsCacheEntryHashTable not initialized");
    if (!initialized)  return NS_ERROR_NOT_INITIALIZED;
    if (!cacheEntry)   return NS_ERROR_NULL_POINTER;

    hashEntry = PL_DHashTableOperate(&table, cacheEntry->mKey, PL_DHASH_ADD);
#ifndef DEBUG_dougt
    NS_ASSERTION(((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry == 0,
                 "### nsCacheEntryHashTable::AddEntry - entry already used");
#endif
    ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry = cacheEntry;

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PR_CALLBACK nsCacheEntryHashTable::ClearEntry ( PLDHashTable table,
PLDHashEntryHdr entry 
) [static, private]

Definition at line 552 of file nsCacheEntry.cpp.

{
    ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry = 0;
}
static void PR_CALLBACK nsCacheEntryHashTable::Finalize ( PLDHashTable table) [static, private]
static PLDHashOperator PR_CALLBACK nsCacheEntryHashTable::FreeCacheEntries ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
) [static, private]

Definition at line 439 of file nsCacheEntry.cpp.

{
    PLDHashEntryHdr *hashEntry;
    nsCacheEntry    *result = nsnull;

    NS_ASSERTION(initialized, "nsCacheEntryHashTable not initialized");
    if (!initialized)  return nsnull;
    
    hashEntry = PL_DHashTableOperate(&table, key, PL_DHASH_LOOKUP);
    if (PL_DHASH_ENTRY_IS_BUSY(hashEntry)) {
        result = ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry;
    }
    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const void *PR_CALLBACK nsCacheEntryHashTable::GetKey ( PLDHashTable table,
PLDHashEntryHdr entry 
) [static, private]

hash table operation callback functions

Definition at line 516 of file nsCacheEntry.cpp.

{
    nsCacheEntry *cacheEntry = ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry;
    return cacheEntry->mKey;
}
PLDHashNumber PR_CALLBACK nsCacheEntryHashTable::HashKey ( PLDHashTable table,
const void key 
) [static, private]

Definition at line 524 of file nsCacheEntry.cpp.

{
    return PL_DHashStringKey(table,((nsCString *)key)->get());
}

Here is the call graph for this function:

Definition at line 417 of file nsCacheEntry.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool PR_CALLBACK nsCacheEntryHashTable::MatchEntry ( PLDHashTable table,
const PLDHashEntryHdr entry,
const void key 
) [static, private]

Definition at line 530 of file nsCacheEntry.cpp.

{
    NS_ASSERTION(key !=  nsnull, "### nsCacheEntryHashTable::MatchEntry : null key");
    nsCacheEntry *cacheEntry = ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry;

    return cacheEntry->mKey->Equals(*(nsCString *)key);
}

Definition at line 542 of file nsCacheEntry.cpp.

{
    ((nsCacheEntryHashTableEntry *)to)->cacheEntry =
        ((nsCacheEntryHashTableEntry *)from)->cacheEntry;
}

Definition at line 476 of file nsCacheEntry.cpp.

{
    NS_ASSERTION(initialized, "nsCacheEntryHashTable not initialized");
    NS_ASSERTION(cacheEntry, "### cacheEntry == nsnull");

    if (!initialized)  return; // NS_ERROR_NOT_INITIALIZED

#if DEBUG
    // XXX debug code to make sure we have the entry we're trying to remove
    nsCacheEntry *check = GetEntry(cacheEntry->mKey);
    NS_ASSERTION(check == cacheEntry, "### Attempting to remove unknown cache entry!!!");
#endif
    (void) PL_DHashTableOperate(&table, cacheEntry->mKey, PL_DHASH_REMOVE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 429 of file nsCacheEntry.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 493 of file nsCacheEntry.cpp.

{
    NS_ASSERTION(initialized, "nsCacheEntryHashTable not initialized");
    if (!initialized)  return; // NS_ERROR_NOT_INITIALIZED
    PL_DHashTableEnumerate(&table, VisitEntry, visitor);
}

Here is the call graph for this function:

PLDHashOperator PR_CALLBACK nsCacheEntryHashTable::VisitEntry ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
) [static, private]

Definition at line 502 of file nsCacheEntry.cpp.

{
    nsCacheEntry *cacheEntry = ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry;
    nsCacheEntryHashTable::Visitor *visitor = (nsCacheEntryHashTable::Visitor*) arg;
    return (visitor->VisitEntry(cacheEntry) ? PL_DHASH_NEXT : PL_DHASH_STOP);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsCacheService [friend]

Definition at line 303 of file nsCacheEntry.h.


Member Data Documentation

Definition at line 336 of file nsCacheEntry.h.

Definition at line 335 of file nsCacheEntry.h.


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