summaryrefslogtreecommitdiff
path: root/indra/llimage
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-06-05 19:05:43 -0700
committerRichard Linden <none@none>2013-06-05 19:05:43 -0700
commit0a96b47663c99914c587cdcb8bcdc096bbf55fa3 (patch)
tree67bca4958927ed7f6df423de05e42cd271292391 /indra/llimage
parentdcfb18373eca7986a73d8b9a1d34970cc0a23ed9 (diff)
parenta74b5dfa923f8eeccc9b786143f0f832de3ad450 (diff)
merge with viewer-release
Diffstat (limited to 'indra/llimage')
-rwxr-xr-xindra/llimage/llimage.cpp8
-rwxr-xr-xindra/llimage/llimage.h7
-rwxr-xr-xindra/llimage/tests/llimageworker_test.cpp10
3 files changed, 23 insertions, 2 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 1c25256e95..50df2ebe55 100755
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -50,6 +50,7 @@ LLMutex* LLImage::sMutex = NULL;
bool LLImage::sUseNewByteRange = false;
S32 LLImage::sMinimalReverseByteRangePercent = 75;
LLPrivateMemoryPool* LLImageBase::sPrivatePoolp = NULL ;
+LLTrace::MemStatHandle LLImageBase::sMemStat("LLImage");
//static
void LLImage::initClass(bool use_new_byte_range, S32 minimal_reverse_byte_range_percent)
@@ -158,6 +159,7 @@ void LLImageBase::sanityCheck()
void LLImageBase::deleteData()
{
FREE_MEM(sPrivatePoolp, mData) ;
+ memDisclaimAmount(mDataSize);
mData = NULL;
mDataSize = 0;
}
@@ -201,6 +203,7 @@ U8* LLImageBase::allocateData(S32 size)
mBadBufferAllocation = true ;
}
mDataSize = size;
+ memClaimAmount(mDataSize);
}
return mData;
@@ -222,7 +225,9 @@ U8* LLImageBase::reallocateData(S32 size)
FREE_MEM(sPrivatePoolp, mData) ;
}
mData = new_datap;
+ memDisclaimAmount(mDataSize);
mDataSize = size;
+ memClaimAmount(mDataSize);
return mData;
}
@@ -288,7 +293,6 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components, bool no_copy)
: LLImageBase()
{
-
if(no_copy)
{
setDataAndSize(data, width, height, components);
@@ -1608,7 +1612,9 @@ static void avg4_colors2(const U8* a, const U8* b, const U8* c, const U8* d, U8*
void LLImageBase::setDataAndSize(U8 *data, S32 size)
{
ll_assert_aligned(data, 16);
+ memDisclaimAmount(mDataSize);
mData = data; mDataSize = size;
+ memClaimAmount(mDataSize);
}
//static
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 4fc40ecff7..504b7e4795 100755
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -30,6 +30,7 @@
#include "lluuid.h"
#include "llstring.h"
#include "llthread.h"
+#include "lltrace.h"
const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2
const S32 MAX_IMAGE_MIP = 11; // 2048x2048
@@ -110,7 +111,9 @@ protected:
//============================================================================
// Image base class
-class LLImageBase : public LLThreadSafeRefCount
+class LLImageBase
+: public LLThreadSafeRefCount,
+ public LLTrace::MemTrackable<LLImageBase>
{
protected:
virtual ~LLImageBase();
@@ -162,6 +165,8 @@ public:
static void destroyPrivatePool() ;
static LLPrivateMemoryPool* getPrivatePool() {return sPrivatePoolp;}
+ static LLTrace::MemStatHandle sMemStat;
+
private:
U8 *mData;
S32 mDataSize;
diff --git a/indra/llimage/tests/llimageworker_test.cpp b/indra/llimage/tests/llimageworker_test.cpp
index e255d65b43..b6f2694742 100755
--- a/indra/llimage/tests/llimageworker_test.cpp
+++ b/indra/llimage/tests/llimageworker_test.cpp
@@ -31,6 +31,8 @@
#include "../llimageworker.h"
// For timer class
#include "../llcommon/lltimer.h"
+// for lltrace class
+#include "../llcommon/lltrace.h"
// Tut header
#include "../test/lltut.h"
@@ -42,6 +44,9 @@
// * Do not make any assumption as to how those classes or methods work (i.e. don't copy/paste code)
// * A simulator for a class can be implemented here. Please comment and document thoroughly.
+LLTrace::MemStatHandle LLImageBase::sMemStat("LLImage");
+
+
LLImageBase::LLImageBase()
: mData(NULL),
mDataSize(0),
@@ -114,11 +119,13 @@ namespace tut
// Constructor and destructor of the test wrapper
imagedecodethread_test()
{
+ LLTrace::init();
mThread = NULL;
}
~imagedecodethread_test()
{
delete mThread;
+ LLTrace::cleanup();
}
};
@@ -136,6 +143,8 @@ namespace tut
imagerequest_test()
{
done = false;
+ LLTrace::init();
+
mRequest = new LLImageDecodeThread::ImageRequest(0, 0,
LLQueuedThread::PRIORITY_NORMAL, 0, FALSE,
new responder_test(&done));
@@ -145,6 +154,7 @@ namespace tut
// We should delete the object *but*, because its destructor is protected, that cannot be
// done from outside an LLImageDecodeThread instance... So we leak memory here... It's fine...
//delete mRequest;
+ LLTrace::cleanup();
}
};