Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim:set ts=4 sw=4 sts=4 et cin: */ |
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 | #ifndef HttpLog_h__ |
michael@0 | 8 | #define HttpLog_h__ |
michael@0 | 9 | |
michael@0 | 10 | |
michael@0 | 11 | /******************************************************************************* |
michael@0 | 12 | * This file should ONLY be #included by source (.cpp) files in the /http |
michael@0 | 13 | * directory, not headers (.h). If you need to use LOG() in a .h file, call |
michael@0 | 14 | * PR_LOG directly. |
michael@0 | 15 | * |
michael@0 | 16 | * This file should also be the first #include in your file. |
michael@0 | 17 | * |
michael@0 | 18 | * Yes, this is kludgy. |
michael@0 | 19 | *******************************************************************************/ |
michael@0 | 20 | |
michael@0 | 21 | |
michael@0 | 22 | // e10s mess: IPDL-generated headers include chromium files that both #include |
michael@0 | 23 | // prlog.h, and #define LOG in conflict with this file. |
michael@0 | 24 | // Solution: (as described in bug 545995) |
michael@0 | 25 | // 1) ensure that this file is #included before any IPDL-generated files and |
michael@0 | 26 | // anything else that #includes prlog.h, so that we can make sure prlog.h |
michael@0 | 27 | // sees FORCE_PR_LOG |
michael@0 | 28 | // 2) #include IPDL boilerplate, and then undef LOG so our LOG wins. |
michael@0 | 29 | // 3) nsNetModule.cpp does its own crazy stuff with #including prlog.h |
michael@0 | 30 | // multiple times; allow it to define ALLOW_LATE_HTTPLOG_H_INCLUDE to bypass |
michael@0 | 31 | // check. |
michael@0 | 32 | #if defined(PR_LOG) && !defined(ALLOW_LATE_HTTPLOG_H_INCLUDE) |
michael@0 | 33 | #error "If HttpLog.h #included it must come before any IPDL-generated files or other files that #include prlog.h" |
michael@0 | 34 | #endif |
michael@0 | 35 | |
michael@0 | 36 | // NeckoChild.h will include chromium, which will include prlog.h so define |
michael@0 | 37 | // PR_FORCE before we do that. |
michael@0 | 38 | #if defined(MOZ_LOGGING) |
michael@0 | 39 | #define FORCE_PR_LOG |
michael@0 | 40 | #endif |
michael@0 | 41 | |
michael@0 | 42 | #include "mozilla/net/NeckoChild.h" |
michael@0 | 43 | |
michael@0 | 44 | // Get rid of Chromium's LOG definition |
michael@0 | 45 | #undef LOG |
michael@0 | 46 | |
michael@0 | 47 | #if defined(PR_LOGGING) |
michael@0 | 48 | // |
michael@0 | 49 | // Log module for HTTP Protocol logging... |
michael@0 | 50 | // |
michael@0 | 51 | // To enable logging (see prlog.h for full details): |
michael@0 | 52 | // |
michael@0 | 53 | // set NSPR_LOG_MODULES=nsHttp:5 |
michael@0 | 54 | // set NSPR_LOG_FILE=http.log |
michael@0 | 55 | // |
michael@0 | 56 | // this enables PR_LOG_ALWAYS level information and places all output in |
michael@0 | 57 | // the file http.log |
michael@0 | 58 | // |
michael@0 | 59 | extern PRLogModuleInfo *gHttpLog; |
michael@0 | 60 | #endif |
michael@0 | 61 | |
michael@0 | 62 | // http logging |
michael@0 | 63 | #define LOG1(args) PR_LOG(gHttpLog, 1, args) |
michael@0 | 64 | #define LOG2(args) PR_LOG(gHttpLog, 2, args) |
michael@0 | 65 | #define LOG3(args) PR_LOG(gHttpLog, 3, args) |
michael@0 | 66 | #define LOG4(args) PR_LOG(gHttpLog, 4, args) |
michael@0 | 67 | #define LOG5(args) PR_LOG(gHttpLog, 5, args) |
michael@0 | 68 | #define LOG(args) LOG4(args) |
michael@0 | 69 | |
michael@0 | 70 | #define LOG1_ENABLED() PR_LOG_TEST(gHttpLog, 1) |
michael@0 | 71 | #define LOG2_ENABLED() PR_LOG_TEST(gHttpLog, 2) |
michael@0 | 72 | #define LOG3_ENABLED() PR_LOG_TEST(gHttpLog, 3) |
michael@0 | 73 | #define LOG4_ENABLED() PR_LOG_TEST(gHttpLog, 4) |
michael@0 | 74 | #define LOG5_ENABLED() PR_LOG_TEST(gHttpLog, 5) |
michael@0 | 75 | #define LOG_ENABLED() LOG4_ENABLED() |
michael@0 | 76 | |
michael@0 | 77 | #endif // HttpLog_h__ |