diff options
author | Richard Linden <none@none> | 2013-01-08 23:50:27 -0800 |
---|---|---|
committer | Richard Linden <none@none> | 2013-01-08 23:50:27 -0800 |
commit | 0ba9a00c3116b69745f2d5070ce772d5d4965dbf (patch) | |
tree | d79795487a3bddf08ade8cef0a2a96d3e1ffb92f /indra/llcommon | |
parent | 2f91ffb45c44c3406b1b97dc987cfb7593852a46 (diff) |
SH-3468 WIP add memory tracking base class
cleaned up hacks used to get unit tests working
LLTrace::init now supports recursive initialization/cleanup
put NOMINMAX back in win32 header wrappers
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/lltrace.cpp | 17 | ||||
-rw-r--r-- | indra/llcommon/llwin32headers.h | 4 | ||||
-rw-r--r-- | indra/llcommon/llwin32headerslean.h | 4 |
3 files changed, 19 insertions, 6 deletions
diff --git a/indra/llcommon/lltrace.cpp b/indra/llcommon/lltrace.cpp index 9cadd70dd8..463048008f 100644 --- a/indra/llcommon/lltrace.cpp +++ b/indra/llcommon/lltrace.cpp @@ -30,7 +30,7 @@ #include "lltracethreadrecorder.h" #include "llfasttimer.h" -static bool sInitialized; +static S32 sInitializationCount = 0; namespace LLTrace { @@ -39,19 +39,24 @@ static MasterThreadRecorder* gMasterThreadRecorder = NULL; void init() { - gMasterThreadRecorder = new MasterThreadRecorder(); - sInitialized = true; + if (sInitializationCount++ == 0) + { + gMasterThreadRecorder = new MasterThreadRecorder(); + } } bool isInitialized() { - return sInitialized; + return sInitializationCount > 0; } void cleanup() { - delete gMasterThreadRecorder; - gMasterThreadRecorder = NULL; + if (--sInitializationCount == 0) + { + delete gMasterThreadRecorder; + gMasterThreadRecorder = NULL; + } } MasterThreadRecorder& getMasterThreadRecorder() diff --git a/indra/llcommon/llwin32headers.h b/indra/llcommon/llwin32headers.h index 9c89b6b280..8534ed6298 100644 --- a/indra/llcommon/llwin32headers.h +++ b/indra/llcommon/llwin32headers.h @@ -28,9 +28,13 @@ #define LL_LLWINDOWS_H #ifdef LL_WINDOWS +#ifndef NOMINMAX +#define NOMINMAX +#endif #undef WIN32_LEAN_AND_MEAN #include <winsock2.h> #include <windows.h> +#undef NOMINMAX #endif #endif diff --git a/indra/llcommon/llwin32headerslean.h b/indra/llcommon/llwin32headerslean.h index d3fb90d4b1..f7e71301a8 100644 --- a/indra/llcommon/llwin32headerslean.h +++ b/indra/llcommon/llwin32headerslean.h @@ -28,9 +28,13 @@ #define LL_LLWINDOWS_H #ifdef LL_WINDOWS +#ifndef NOMINMAX +#define NOMINMAX +#endif #define WIN32_LEAN_AND_MEAN #include <winsock2.h> #include <windows.h> +#undef NOMINMAX #endif #endif |