Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsCache.h File Reference
#include "nsISupports.h"
#include "nsIFile.h"
#include "nsAString.h"
#include "prtime.h"
#include "nsError.h"
#include "prlog.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CACHE_LOG_INIT()   {}
 Cache Service Utility Functions.
#define CACHE_LOG_ALWAYS(args)   {}
#define CACHE_LOG_ERROR(args)   {}
#define CACHE_LOG_WARNING(args)   {}
#define CACHE_LOG_DEBUG(args)   {}
#define CACHE_LOG_PATH(level, format, item)   {}

Functions

PRUint32 SecondsFromPRTime (PRTime prTime)
 Cache Service Utility Functions.
PRTime PRTimeFromSeconds (PRUint32 seconds)
nsresult ClientIDFromCacheKey (const nsACString &key, char **result)
nsresult ClientKeyFromCacheKey (const nsCString &key, nsACString &result)

Define Documentation

#define CACHE_LOG_ALWAYS (   args)    {}

Definition at line 73 of file nsCache.h.

#define CACHE_LOG_DEBUG (   args)    {}

Definition at line 76 of file nsCache.h.

#define CACHE_LOG_ERROR (   args)    {}

Definition at line 74 of file nsCache.h.

#define CACHE_LOG_INIT ( )    {}

Cache Service Utility Functions.

Definition at line 72 of file nsCache.h.

#define CACHE_LOG_PATH (   level,
  format,
  item 
)    {}

Definition at line 77 of file nsCache.h.

#define CACHE_LOG_WARNING (   args)    {}

Definition at line 75 of file nsCache.h.


Function Documentation

nsresult ClientIDFromCacheKey ( const nsACString &  key,
char **  result 
)

Definition at line 108 of file nsCache.cpp.

{
    nsresult  rv = NS_OK;
    *result = nsnull;

    nsReadingIterator<char> colon;
    key.BeginReading(colon);
        
    nsReadingIterator<char> start;
    key.BeginReading(start);
        
    nsReadingIterator<char> end;
    key.EndReading(end);
        
    if (FindCharInReadable(':', colon, end)) {
        *result = ToNewCString( Substring(start, colon));
        if (!*result) rv = NS_ERROR_OUT_OF_MEMORY;
    } else {
        NS_ASSERTION(PR_FALSE, "FindCharInRead failed to find ':'");
        rv = NS_ERROR_UNEXPECTED;
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult ClientKeyFromCacheKey ( const nsCString key,
nsACString &  result 
)

Definition at line 134 of file nsCache.cpp.

{
    nsresult  rv = NS_OK;

    nsReadingIterator<char> start;
    key.BeginReading(start);
        
    nsReadingIterator<char> end;
    key.EndReading(end);
        
    if (FindCharInReadable(':', start, end)) {
        ++start;  // advance past clientID ':' delimiter
        result.Assign(Substring(start, end));
    } else {
        NS_ASSERTION(PR_FALSE, "FindCharInRead failed to find ':'");
        rv = NS_ERROR_UNEXPECTED;
        result.Truncate(0);
    }
    return rv;
}

Here is the call graph for this function:

Definition at line 95 of file nsCache.cpp.

{
  PRInt64 microSecondsPerSecond, intermediateResult;
  PRTime  prTime;

  LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
  LL_UI2L(intermediateResult, seconds);
  LL_MUL(prTime, intermediateResult, microSecondsPerSecond);
  return prTime;
}

Here is the caller graph for this function:

Cache Service Utility Functions.

Definition at line 82 of file nsCache.cpp.

{
  PRInt64  microSecondsPerSecond, intermediateResult;
  PRUint32 seconds;

  LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
  LL_DIV(intermediateResult, prTime, microSecondsPerSecond);
  LL_L2UI(seconds, intermediateResult);
  return seconds;
}