summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatermemleak.cpp
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@lindenlab.com>2009-08-31 13:47:47 -0700
committerBryan O'Sullivan <bos@lindenlab.com>2009-08-31 13:47:47 -0700
commit30ff6cabd61f2f083df5df1e6e70cc94742af477 (patch)
tree631935f1cf59d19a91cdad65e9a75fe825afda7d /indra/newview/llfloatermemleak.cpp
parentff11d74820c89822cd067b51727d9df1dc87d0d0 (diff)
parent3ac3a4b206c08ed06b889bdaa24074b6aa0e020a (diff)
Merge with trunk
Diffstat (limited to 'indra/newview/llfloatermemleak.cpp')
-rw-r--r--indra/newview/llfloatermemleak.cpp162
1 files changed, 62 insertions, 100 deletions
diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp
index df51918e35..529bd68e03 100644
--- a/indra/newview/llfloatermemleak.cpp
+++ b/indra/newview/llfloatermemleak.cpp
@@ -42,24 +42,56 @@
#include "llmath.h"
#include "llviewerwindow.h"
-LLFloaterMemLeak* LLFloaterMemLeak::sInstance = NULL;
U32 LLFloaterMemLeak::sMemLeakingSpeed = 0 ; //bytes leaked per frame
U32 LLFloaterMemLeak::sMaxLeakedMem = 0 ; //maximum allowed leaked memory
U32 LLFloaterMemLeak::sTotalLeaked = 0 ;
S32 LLFloaterMemLeak::sStatus = LLFloaterMemLeak::STOP ;
BOOL LLFloaterMemLeak::sbAllocationFailed = FALSE ;
-LLFloaterMemLeak::LLFloaterMemLeak() : LLFloater("Memory Leaking Simulation Floater")
+LLFloaterMemLeak::LLFloaterMemLeak(const LLSD& key)
+ : LLFloater(key)
{
+ setTitle("Memory Leaking Simulation Floater");
+ mCommitCallbackRegistrar.add("MemLeak.ChangeLeakingSpeed", boost::bind(&LLFloaterMemLeak::onChangeLeakingSpeed, this));
+ mCommitCallbackRegistrar.add("MemLeak.ChangeMaxMemLeaking", boost::bind(&LLFloaterMemLeak::onChangeMaxMemLeaking, this));
+ mCommitCallbackRegistrar.add("MemLeak.Start", boost::bind(&LLFloaterMemLeak::onClickStart, this));
+ mCommitCallbackRegistrar.add("MemLeak.Stop", boost::bind(&LLFloaterMemLeak::onClickStop, this));
+ mCommitCallbackRegistrar.add("MemLeak.Release", boost::bind(&LLFloaterMemLeak::onClickRelease, this));
+ mCommitCallbackRegistrar.add("MemLeak.Close", boost::bind(&LLFloaterMemLeak::onClickClose, this));
}
+//----------------------------------------------
+BOOL LLFloaterMemLeak::postBuild(void)
+{
+ F32 a, b ;
+ a = childGetValue("leak_speed").asReal();
+ if(a > (F32)(0xFFFFFFFF))
+ {
+ sMemLeakingSpeed = 0xFFFFFFFF ;
+ }
+ else
+ {
+ sMemLeakingSpeed = (U32)a ;
+ }
+ b = childGetValue("max_leak").asReal();
+ if(b > (F32)0xFFF)
+ {
+ sMaxLeakedMem = 0xFFFFFFFF ;
+ }
+ else
+ {
+ sMaxLeakedMem = ((U32)b) << 20 ;
+ }
+
+ sbAllocationFailed = FALSE ;
+ return TRUE ;
+}
LLFloaterMemLeak::~LLFloaterMemLeak()
{
release() ;
sMemLeakingSpeed = 0 ; //bytes leaked per frame
sMaxLeakedMem = 0 ; //maximum allowed leaked memory
- sInstance = NULL ;
}
void LLFloaterMemLeak::release()
@@ -115,79 +147,56 @@ void LLFloaterMemLeak::idle()
}
//----------------------
-void LLFloaterMemLeak::onChangeLeakingSpeed(LLUICtrl* ctrl, void* userData)
+void LLFloaterMemLeak::onChangeLeakingSpeed()
{
- LLFloaterMemLeak *mem_leak = (LLFloaterMemLeak *)userData;
- if (mem_leak)
- {
- F32 tmp ;
- tmp = mem_leak->childGetValue("leak_speed").asReal();
+ F32 tmp ;
+ tmp =childGetValue("leak_speed").asReal();
- if(tmp > (F32)0xFFFFFFFF)
- {
- sMemLeakingSpeed = 0xFFFFFFFF ;
- }
- else
- {
- sMemLeakingSpeed = (U32)tmp ;
- }
+ if(tmp > (F32)0xFFFFFFFF)
+ {
+ sMemLeakingSpeed = 0xFFFFFFFF ;
}
+ else
+ {
+ sMemLeakingSpeed = (U32)tmp ;
+ }
+
}
-void LLFloaterMemLeak::onChangeMaxMemLeaking(LLUICtrl* ctrl, void* userData)
+void LLFloaterMemLeak::onChangeMaxMemLeaking()
{
- LLFloaterMemLeak *mem_leak = (LLFloaterMemLeak *)userData;
- if (mem_leak)
+
+ F32 tmp ;
+ tmp =childGetValue("max_leak").asReal();
+ if(tmp > (F32)0xFFF)
{
- F32 tmp ;
- tmp = mem_leak->childGetValue("max_leak").asReal();
- if(tmp > (F32)0xFFF)
- {
- sMaxLeakedMem = 0xFFFFFFFF ;
- }
- else
- {
- sMaxLeakedMem = ((U32)tmp) << 20 ;
- }
+ sMaxLeakedMem = 0xFFFFFFFF ;
}
+ else
+ {
+ sMaxLeakedMem = ((U32)tmp) << 20 ;
+ }
+
}
-void LLFloaterMemLeak::onClickStart(void* userData)
+void LLFloaterMemLeak::onClickStart()
{
sStatus = START ;
}
-void LLFloaterMemLeak::onClickStop(void* userData)
+void LLFloaterMemLeak::onClickStop()
{
sStatus = STOP ;
}
-void LLFloaterMemLeak::onClickRelease(void* userData)
+void LLFloaterMemLeak::onClickRelease()
{
sStatus = RELEASE ;
}
-void LLFloaterMemLeak::onClickClose(void* userData)
-{
- if (sInstance)
- {
- sInstance->setVisible(FALSE);
- }
-}
-
-//----------------------------------------------
-
-BOOL LLFloaterMemLeak::postBuild(void)
+void LLFloaterMemLeak::onClickClose()
{
- childSetCommitCallback("leak_speed", onChangeLeakingSpeed, this);
- childSetCommitCallback("max_leak", onChangeMaxMemLeaking, this);
-
- childSetAction("start_btn", onClickStart, this);
- childSetAction("stop_btn", onClickStop, this);
- childSetAction("release_btn", onClickRelease, this);
- childSetAction("close_btn", onClickClose, this);
-
- return TRUE ;
+ setVisible(FALSE);
}
void LLFloaterMemLeak::draw()
@@ -217,50 +226,3 @@ void LLFloaterMemLeak::draw()
LLFloater::draw();
}
-
-// static instance of it
-LLFloaterMemLeak* LLFloaterMemLeak::instance()
-{
- if (!sInstance)
- {
- sInstance = new LLFloaterMemLeak();
- LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_mem_leaking.xml", NULL, FALSE);
-
- if(sInstance)
- {
- F32 a, b ;
- a = sInstance->childGetValue("leak_speed").asReal();
- if(a > (F32)(0xFFFFFFFF))
- {
- sMemLeakingSpeed = 0xFFFFFFFF ;
- }
- else
- {
- sMemLeakingSpeed = (U32)a ;
- }
- b = sInstance->childGetValue("max_leak").asReal();
- if(b > (F32)0xFFF)
- {
- sMaxLeakedMem = 0xFFFFFFFF ;
- }
- else
- {
- sMaxLeakedMem = ((U32)b) << 20 ;
- }
-
- sbAllocationFailed = FALSE ;
- }
- }
- return sInstance ;
-}
-
-void LLFloaterMemLeak::show(void*)
-{
- instance()->open();
-}
-
-LLFloaterMemLeak* LLFloaterMemLeak::getInstance()
-{
- return sInstance ;
-}
-