Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * Cache Service Utility Functions |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #ifndef _nsCache_h_ |
michael@0 | 12 | #define _nsCache_h_ |
michael@0 | 13 | |
michael@0 | 14 | #if defined(MOZ_LOGGING) |
michael@0 | 15 | #define FORCE_PR_LOG |
michael@0 | 16 | #endif |
michael@0 | 17 | |
michael@0 | 18 | #if defined(PR_LOG) |
michael@0 | 19 | #error "If nsCache.h #included it must come before any files that #include prlog.h" |
michael@0 | 20 | #endif |
michael@0 | 21 | |
michael@0 | 22 | #include "prlog.h" |
michael@0 | 23 | #include "nsISupports.h" |
michael@0 | 24 | #include "nsIFile.h" |
michael@0 | 25 | #include "nsAString.h" |
michael@0 | 26 | #include "prtime.h" |
michael@0 | 27 | #include "nsError.h" |
michael@0 | 28 | |
michael@0 | 29 | // PR_LOG args = "format string", arg, arg, ... |
michael@0 | 30 | #if defined(PR_LOGGING) |
michael@0 | 31 | extern PRLogModuleInfo * gCacheLog; |
michael@0 | 32 | void CacheLogInit(); |
michael@0 | 33 | void CacheLogPrintPath(PRLogModuleLevel level, |
michael@0 | 34 | const char * format, |
michael@0 | 35 | nsIFile * item); |
michael@0 | 36 | #define CACHE_LOG_INIT() CacheLogInit() |
michael@0 | 37 | #define CACHE_LOG_ALWAYS(args) PR_LOG(gCacheLog, PR_LOG_ALWAYS, args) |
michael@0 | 38 | #define CACHE_LOG_ERROR(args) PR_LOG(gCacheLog, PR_LOG_ERROR, args) |
michael@0 | 39 | #define CACHE_LOG_WARNING(args) PR_LOG(gCacheLog, PR_LOG_WARNING, args) |
michael@0 | 40 | #define CACHE_LOG_DEBUG(args) PR_LOG(gCacheLog, PR_LOG_DEBUG, args) |
michael@0 | 41 | #define CACHE_LOG_PATH(level, format, item) \ |
michael@0 | 42 | CacheLogPrintPath(level, format, item) |
michael@0 | 43 | #else |
michael@0 | 44 | #define CACHE_LOG_INIT() {} |
michael@0 | 45 | #define CACHE_LOG_ALWAYS(args) {} |
michael@0 | 46 | #define CACHE_LOG_ERROR(args) {} |
michael@0 | 47 | #define CACHE_LOG_WARNING(args) {} |
michael@0 | 48 | #define CACHE_LOG_DEBUG(args) {} |
michael@0 | 49 | #define CACHE_LOG_PATH(level, format, item) {} |
michael@0 | 50 | #endif |
michael@0 | 51 | |
michael@0 | 52 | |
michael@0 | 53 | extern uint32_t SecondsFromPRTime(PRTime prTime); |
michael@0 | 54 | extern PRTime PRTimeFromSeconds(uint32_t seconds); |
michael@0 | 55 | |
michael@0 | 56 | |
michael@0 | 57 | extern nsresult ClientIDFromCacheKey(const nsACString& key, char ** result); |
michael@0 | 58 | extern nsresult ClientKeyFromCacheKey(const nsCString& key, nsACString &result); |
michael@0 | 59 | |
michael@0 | 60 | |
michael@0 | 61 | #endif // _nsCache_h |