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 wrappersmaster
parent
2f91ffb45c
commit
0ba9a00c31
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -831,7 +831,6 @@ namespace tut
|
|||
public:
|
||||
PumpAndChainTestData()
|
||||
{
|
||||
LLCommon::initClass();
|
||||
apr_pool_create(&mPool, NULL);
|
||||
mPump = new LLPumpIO(mPool);
|
||||
}
|
||||
|
|
@ -841,7 +840,6 @@ namespace tut
|
|||
mChain.clear();
|
||||
delete mPump;
|
||||
apr_pool_destroy(mPool);
|
||||
LLCommon::cleanupClass();
|
||||
}
|
||||
};
|
||||
typedef test_group<PumpAndChainTestData> PumpAndChainTestGroup;
|
||||
|
|
@ -912,7 +910,6 @@ namespace tut
|
|||
|
||||
pipe_and_pump_fitness()
|
||||
{
|
||||
LLCommon::initClass();
|
||||
LLFrameTimer::updateFrameTime();
|
||||
apr_pool_create(&mPool, NULL);
|
||||
mPump = new LLPumpIO(mPool);
|
||||
|
|
@ -927,7 +924,6 @@ namespace tut
|
|||
mSocket.reset();
|
||||
delete mPump;
|
||||
apr_pool_destroy(mPool);
|
||||
LLCommon::cleanupClass();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
@ -1191,11 +1187,9 @@ namespace tut
|
|||
LLSimpleRPCResponse(LLSD* response) :
|
||||
mResponsePtr(response)
|
||||
{
|
||||
LLCommon::initClass();
|
||||
}
|
||||
~LLSimpleRPCResponse()
|
||||
{
|
||||
LLCommon::cleanupClass();
|
||||
}
|
||||
virtual bool response(LLPumpIO* pump)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,11 +41,9 @@ namespace tut
|
|||
{
|
||||
httpdate_data()
|
||||
{
|
||||
LLCommon::initClass();
|
||||
}
|
||||
~httpdate_data()
|
||||
{
|
||||
LLCommon::cleanupClass();
|
||||
}
|
||||
LLDate some_date;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ namespace tut
|
|||
HTTPServiceTestData()
|
||||
: mResponse(NULL)
|
||||
{
|
||||
LLCommon::initClass();
|
||||
LLHTTPStandardServices::useServices();
|
||||
LLHTTPRegistrar::buildAllServices(mRoot);
|
||||
mRoot.addNode("/delayed/echo", new DelayedEcho(this));
|
||||
|
|
@ -86,7 +85,6 @@ namespace tut
|
|||
|
||||
~HTTPServiceTestData()
|
||||
{
|
||||
LLCommon::cleanupClass();
|
||||
}
|
||||
|
||||
LLHTTPNode mRoot;
|
||||
|
|
|
|||
|
|
@ -514,8 +514,8 @@ int main(int argc, char **argv)
|
|||
#endif
|
||||
|
||||
ll_init_apr();
|
||||
LLTrace::init();
|
||||
|
||||
LLTrace::init();
|
||||
apr_getopt_t* os = NULL;
|
||||
if(APR_SUCCESS != apr_getopt_init(&os, gAPRPoolp, argc, argv))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@
|
|||
#if LL_WINDOWS
|
||||
#pragma warning(disable: 4263)
|
||||
#pragma warning(disable: 4264)
|
||||
#undef NOMINMAX
|
||||
#endif
|
||||
|
||||
#if __APPLE__
|
||||
|
|
|
|||
Loading…
Reference in New Issue