netwerk/cache/nsCache.h

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

mercurial