1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/cache/nsCache.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +/** 1.11 + * Cache Service Utility Functions 1.12 + */ 1.13 + 1.14 +#ifndef _nsCache_h_ 1.15 +#define _nsCache_h_ 1.16 + 1.17 +#if defined(MOZ_LOGGING) 1.18 +#define FORCE_PR_LOG 1.19 +#endif 1.20 + 1.21 +#if defined(PR_LOG) 1.22 +#error "If nsCache.h #included it must come before any files that #include prlog.h" 1.23 +#endif 1.24 + 1.25 +#include "prlog.h" 1.26 +#include "nsISupports.h" 1.27 +#include "nsIFile.h" 1.28 +#include "nsAString.h" 1.29 +#include "prtime.h" 1.30 +#include "nsError.h" 1.31 + 1.32 +// PR_LOG args = "format string", arg, arg, ... 1.33 +#if defined(PR_LOGGING) 1.34 +extern PRLogModuleInfo * gCacheLog; 1.35 +void CacheLogInit(); 1.36 +void CacheLogPrintPath(PRLogModuleLevel level, 1.37 + const char * format, 1.38 + nsIFile * item); 1.39 +#define CACHE_LOG_INIT() CacheLogInit() 1.40 +#define CACHE_LOG_ALWAYS(args) PR_LOG(gCacheLog, PR_LOG_ALWAYS, args) 1.41 +#define CACHE_LOG_ERROR(args) PR_LOG(gCacheLog, PR_LOG_ERROR, args) 1.42 +#define CACHE_LOG_WARNING(args) PR_LOG(gCacheLog, PR_LOG_WARNING, args) 1.43 +#define CACHE_LOG_DEBUG(args) PR_LOG(gCacheLog, PR_LOG_DEBUG, args) 1.44 +#define CACHE_LOG_PATH(level, format, item) \ 1.45 + CacheLogPrintPath(level, format, item) 1.46 +#else 1.47 +#define CACHE_LOG_INIT() {} 1.48 +#define CACHE_LOG_ALWAYS(args) {} 1.49 +#define CACHE_LOG_ERROR(args) {} 1.50 +#define CACHE_LOG_WARNING(args) {} 1.51 +#define CACHE_LOG_DEBUG(args) {} 1.52 +#define CACHE_LOG_PATH(level, format, item) {} 1.53 +#endif 1.54 + 1.55 + 1.56 +extern uint32_t SecondsFromPRTime(PRTime prTime); 1.57 +extern PRTime PRTimeFromSeconds(uint32_t seconds); 1.58 + 1.59 + 1.60 +extern nsresult ClientIDFromCacheKey(const nsACString& key, char ** result); 1.61 +extern nsresult ClientKeyFromCacheKey(const nsCString& key, nsACString &result); 1.62 + 1.63 + 1.64 +#endif // _nsCache_h