diff options
author | James Cook <james@lindenlab.com> | 2009-07-07 00:53:05 +0000 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-07-07 00:53:05 +0000 |
commit | 52aeaa32841e7d0b37abab0a2a2540c2be2f16b7 (patch) | |
tree | d8f5c98644029dd289a97aa0d8b55c5a6200c214 /indra/newview/llfloatermemleak.cpp | |
parent | 2c722655bd6701a3dc8518c6518c51f538765dcd (diff) |
Merge skinning-14 to viewer-2, including refactoring many floaters to register them with LLFloaterReg, support for introspection of ParamBlock based UI widgets to dump XML schema, splitting llfolderview.cpp into three separate files to unravel dependencies and skeleton for for LLListView widget. Resolved conflicts in these files:
lldraghandle.h, lluictrl.h, llchiclet.cpp, llfolderview.h/cpp, lliinventorybridge.cpp, llpanelpicks.cpp, llviewermenu.cpp, floater_mute.xml, floater_preferences.xml, notifications.xml, panel_preferences_audio.xml, panel_preferences_graphics1.xml, panel_region_general.xml
svn merge -r124961:126284 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-14
Diffstat (limited to 'indra/newview/llfloatermemleak.cpp')
-rw-r--r-- | indra/newview/llfloatermemleak.cpp | 162 |
1 files changed, 61 insertions, 101 deletions
diff --git a/indra/newview/llfloatermemleak.cpp b/indra/newview/llfloatermemleak.cpp index 3f2fcc26db..529bd68e03 100644 --- a/indra/newview/llfloatermemleak.cpp +++ b/indra/newview/llfloatermemleak.cpp @@ -42,26 +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() +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() @@ -117,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() @@ -219,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", 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()->openFloater(); -} - -LLFloaterMemLeak* LLFloaterMemLeak::getInstance() -{ - return sInstance ; -} - |