redid showConstructDestruct

This commit is contained in:
Marty Kraimer
2010-11-17 15:28:18 -05:00
parent d9a56c68a1
commit 28aad96b34
16 changed files with 112 additions and 234 deletions
+5 -26
View File
@@ -22,42 +22,19 @@ static volatile int64 totalDestruct = 0;
static Mutex *globalMutex = 0;
static String alreadyOn("already on list");
class ConstructDestructCallbackEvent : public ConstructDestructCallback {
public:
ConstructDestructCallbackEvent();
virtual String getConstructName();
virtual int64 getTotalConstruct();
virtual int64 getTotalDestruct();
virtual int64 getTotalReferenceCount();
private:
String name;
};
ConstructDestructCallbackEvent::ConstructDestructCallbackEvent()
: name("event")
{
getShowConstructDestruct()->registerCallback(this);
}
String ConstructDestructCallbackEvent::getConstructName() {return name;}
int64 ConstructDestructCallbackEvent::getTotalConstruct()
static int64 getTotalConstruct()
{
Lock xx(globalMutex);
return totalConstruct;
}
int64 ConstructDestructCallbackEvent::getTotalDestruct()
static int64 getTotalDestruct()
{
Lock xx(globalMutex);
return totalDestruct;
}
int64 ConstructDestructCallbackEvent::getTotalReferenceCount()
{
return 0;
}
static ConstructDestructCallback *pConstructDestructCallback;
static void init()
@@ -66,7 +43,9 @@ static void init()
Lock xx(&mutex);
if(globalMutex==0) {
globalMutex = new Mutex();
pConstructDestructCallback = new ConstructDestructCallbackEvent();
pConstructDestructCallback = new ConstructDestructCallback(
String("event"),
getTotalConstruct,getTotalDestruct,0);
}
}