summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-02-02 12:17:29 +0200
committerVadim Savchuk <vsavchuk@productengine.com>2010-02-02 12:17:29 +0200
commit9b0518dd8e46dfe74eaa0f7622b1486dbde32b82 (patch)
tree2c637ad3b5a5cfa8ec1e97c30c3de9efe5cac59b /indra/llcommon
parent7f83000ea13bac5b4cccb9a6f12e764ac8d69b2a (diff)
parent4ad357ec70e15afdfe78816990cb23c7ba17619c (diff)
Merge from default branch
--HG-- branch : product-engine
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llerror.h2
-rw-r--r--indra/llcommon/llpointer.h1
-rw-r--r--indra/llcommon/llrefcount.cpp11
-rw-r--r--indra/llcommon/llrefcount.h14
4 files changed, 19 insertions, 9 deletions
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 5a4c644859..09812de2b8 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -242,7 +242,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
do { \
static LLError::CallSite _site( \
level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, broadTag, narrowTag, once);\
- if (_site.shouldLog()) \
+ if (LL_UNLIKELY(_site.shouldLog())) \
{ \
std::ostringstream* _out = LLError::Log::out(); \
(*_out)
diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h
index 2c37eadcc6..e6c736a263 100644
--- a/indra/llcommon/llpointer.h
+++ b/indra/llcommon/llpointer.h
@@ -95,7 +95,6 @@ public:
bool notNull() const { return (mPointer != NULL); }
operator Type*() const { return mPointer; }
- operator const Type*() const { return mPointer; }
bool operator !=(Type* ptr) const { return (mPointer != ptr); }
bool operator ==(Type* ptr) const { return (mPointer == ptr); }
bool operator ==(const LLPointer<Type>& ptr) const { return (mPointer == ptr.mPointer); }
diff --git a/indra/llcommon/llrefcount.cpp b/indra/llcommon/llrefcount.cpp
index 33b6875fb0..c90b52f482 100644
--- a/indra/llcommon/llrefcount.cpp
+++ b/indra/llcommon/llrefcount.cpp
@@ -35,6 +35,17 @@
#include "llerror.h"
+LLRefCount::LLRefCount(const LLRefCount& other)
+: mRef(0)
+{
+}
+
+LLRefCount& LLRefCount::operator=(const LLRefCount&)
+{
+ // do nothing, since ref count is specific to *this* reference
+ return *this;
+}
+
LLRefCount::LLRefCount() :
mRef(0)
{
diff --git a/indra/llcommon/llrefcount.h b/indra/llcommon/llrefcount.h
index 9ab844eb22..a18f6706a9 100644
--- a/indra/llcommon/llrefcount.h
+++ b/indra/llcommon/llrefcount.h
@@ -41,22 +41,20 @@
class LL_COMMON_API LLRefCount
{
-private:
- LLRefCount(const LLRefCount& other); // no implementation
-private:
- LLRefCount& operator=(const LLRefCount&); // no implementation
protected:
+ LLRefCount(const LLRefCount& other);
+ LLRefCount& operator=(const LLRefCount&);
virtual ~LLRefCount(); // use unref()
public:
LLRefCount();
- void ref()
+ void ref() const
{
mRef++;
}
- S32 unref()
+ S32 unref() const
{
llassert(mRef >= 1);
if (0 == --mRef)
@@ -67,13 +65,15 @@ public:
return mRef;
}
+ //NOTE: when passing around a const LLRefCount object, this can return different results
+ // at different types, since mRef is mutable
S32 getNumRefs() const
{
return mRef;
}
private:
- S32 mRef;
+ mutable S32 mRef;
};
#endif