Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | #ifndef nsTraceRefcnt_h___ |
michael@0 | 6 | #define nsTraceRefcnt_h___ |
michael@0 | 7 | |
michael@0 | 8 | #include <stdio.h> // for FILE |
michael@0 | 9 | #include "nscore.h" |
michael@0 | 10 | |
michael@0 | 11 | class nsTraceRefcnt |
michael@0 | 12 | { |
michael@0 | 13 | public: |
michael@0 | 14 | static void Startup(); |
michael@0 | 15 | static void Shutdown(); |
michael@0 | 16 | |
michael@0 | 17 | enum StatisticsType { |
michael@0 | 18 | ALL_STATS, |
michael@0 | 19 | NEW_STATS |
michael@0 | 20 | }; |
michael@0 | 21 | |
michael@0 | 22 | static nsresult DumpStatistics(StatisticsType type = ALL_STATS, |
michael@0 | 23 | FILE* out = 0); |
michael@0 | 24 | |
michael@0 | 25 | static void ResetStatistics(void); |
michael@0 | 26 | |
michael@0 | 27 | static void DemangleSymbol(const char * aSymbol, |
michael@0 | 28 | char * aBuffer, |
michael@0 | 29 | int aBufLen); |
michael@0 | 30 | |
michael@0 | 31 | static void WalkTheStack(FILE* aStream); |
michael@0 | 32 | /** |
michael@0 | 33 | * Tell nsTraceRefcnt whether refcounting, allocation, and destruction |
michael@0 | 34 | * activity is legal. This is used to trigger assertions for any such |
michael@0 | 35 | * activity that occurs because of static constructors or destructors. |
michael@0 | 36 | */ |
michael@0 | 37 | static void SetActivityIsLegal(bool aLegal); |
michael@0 | 38 | }; |
michael@0 | 39 | |
michael@0 | 40 | #define NS_TRACE_REFCNT_CONTRACTID "@mozilla.org/xpcom/trace-refcnt;1" |
michael@0 | 41 | #define NS_TRACE_REFCNT_CID \ |
michael@0 | 42 | { /* e3e7511e-a395-4924-94b1-d527861cded4 */ \ |
michael@0 | 43 | 0xe3e7511e, \ |
michael@0 | 44 | 0xa395, \ |
michael@0 | 45 | 0x4924, \ |
michael@0 | 46 | {0x94, 0xb1, 0xd5, 0x27, 0x86, 0x1c, 0xde, 0xd4} \ |
michael@0 | 47 | } \ |
michael@0 | 48 | |
michael@0 | 49 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 50 | // And now for that utility that you've all been asking for... |
michael@0 | 51 | |
michael@0 | 52 | extern "C" void |
michael@0 | 53 | NS_MeanAndStdDev(double n, double sumOfValues, double sumOfSquaredValues, |
michael@0 | 54 | double *meanResult, double *stdDevResult); |
michael@0 | 55 | |
michael@0 | 56 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 57 | #endif |