diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/llfasttimer_class.cpp | 6 | ||||
-rw-r--r-- | indra/llcommon/llpointer.h | 1 | ||||
-rw-r--r-- | indra/llcommon/llrefcount.cpp | 11 | ||||
-rw-r--r-- | indra/llcommon/llrefcount.h | 14 | ||||
-rw-r--r-- | indra/llcommon/lltimer.cpp | 6 | ||||
-rw-r--r-- | indra/llcommon/lltimer.h | 1 | ||||
-rw-r--r-- | indra/llcommon/lltreeiterators.h | 34 | ||||
-rw-r--r-- | indra/llcommon/llworkerthread.cpp | 1 |
8 files changed, 48 insertions, 26 deletions
diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index fae0a66873..6d8d81e114 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -114,7 +114,11 @@ static timer_tree_dfs_iterator_t end_timer_tree() class NamedTimerFactory : public LLSingleton<NamedTimerFactory> { public: - NamedTimerFactory() + NamedTimerFactory() + : mActiveTimerRoot(NULL), + mTimerRoot(NULL), + mAppTimer(NULL), + mRootFrameState(NULL) {} /*virtual */ void initSingleton() 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 diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index ef3e8dbc94..21e165ebc9 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -565,19 +565,23 @@ LLEventTimer::LLEventTimer(F32 period) : mEventTimer() { mPeriod = period; + mBusy = false; } LLEventTimer::LLEventTimer(const LLDate& time) : mEventTimer() { mPeriod = (F32)(time.secondsSinceEpoch() - LLDate::now().secondsSinceEpoch()); + mBusy = false; } LLEventTimer::~LLEventTimer() { + llassert(!mBusy); // this LLEventTimer was destroyed from within its own tick() function - bad. if you want tick() to cause destruction of its own timer, make it return true. } +//static void LLEventTimer::updateClass() { std::list<LLEventTimer*> completed_timers; @@ -587,10 +591,12 @@ void LLEventTimer::updateClass() F32 et = timer.mEventTimer.getElapsedTimeF32(); if (timer.mEventTimer.getStarted() && et > timer.mPeriod) { timer.mEventTimer.reset(); + timer.mBusy = true; if ( timer.tick() ) { completed_timers.push_back( &timer ); } + timer.mBusy = false; } } diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index d009c0f5f7..4d995d5bba 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -188,6 +188,7 @@ public: protected: LLTimer mEventTimer; F32 mPeriod; + bool mBusy; }; U64 LL_COMMON_API totalTime(); // Returns current system time in microseconds diff --git a/indra/llcommon/lltreeiterators.h b/indra/llcommon/lltreeiterators.h index c946566e84..cb1304c54e 100644 --- a/indra/llcommon/lltreeiterators.h +++ b/indra/llcommon/lltreeiterators.h @@ -343,20 +343,20 @@ public: /// Instantiate an LLTreeDFSIter to start a depth-first walk. Pass /// functors to extract the 'child begin' and 'child end' iterators from /// each node. - LLTreeDFSIter(const ptr_type& node, const func_type& beginfunc, const func_type& endfunc): - mBeginFunc(beginfunc), - mEndFunc(endfunc), - mSkipChildren(false) + LLTreeDFSIter(const ptr_type& node, const func_type& beginfunc, const func_type& endfunc) + : mBeginFunc(beginfunc), + mEndFunc(endfunc), + mSkipChildren(false) { // Only push back this node if it's non-NULL! if (node) mPending.push_back(node); } /// Instantiate an LLTreeDFSIter to mark the end of the walk - LLTreeDFSIter() {} + LLTreeDFSIter() : mSkipChildren(false) {} - /// flags iterator logic to skip traversing children of current node on next increment - void skipDescendants(bool skip = true) { mSkipChildren = skip; } + /// flags iterator logic to skip traversing children of current node on next increment + void skipDescendants(bool skip = true) { mSkipChildren = skip; } private: /// leverage boost::iterator_facade @@ -405,8 +405,8 @@ private: func_type mBeginFunc; /// functor to extract end() child iterator func_type mEndFunc; - /// flag which controls traversal of children (skip children of current node if true) - bool mSkipChildren; + /// flag which controls traversal of children (skip children of current node if true) + bool mSkipChildren; }; /** @@ -451,21 +451,21 @@ public: /// Instantiate an LLTreeDFSPostIter to start a depth-first walk. Pass /// functors to extract the 'child begin' and 'child end' iterators from /// each node. - LLTreeDFSPostIter(const ptr_type& node, const func_type& beginfunc, const func_type& endfunc): - mBeginFunc(beginfunc), - mEndFunc(endfunc), - mSkipAncestors(false) - { + LLTreeDFSPostIter(const ptr_type& node, const func_type& beginfunc, const func_type& endfunc) + : mBeginFunc(beginfunc), + mEndFunc(endfunc), + mSkipAncestors(false) + { if (! node) return; mPending.push_back(typename list_type::value_type(node, false)); makeCurrent(); } /// Instantiate an LLTreeDFSPostIter to mark the end of the walk - LLTreeDFSPostIter() {} + LLTreeDFSPostIter() : mSkipAncestors(false) {} - /// flags iterator logic to skip traversing ancestors of current node on next increment - void skipAncestors(bool skip = true) { mSkipAncestors = skip; } + /// flags iterator logic to skip traversing ancestors of current node on next increment + void skipAncestors(bool skip = true) { mSkipAncestors = skip; } private: /// leverage boost::iterator_facade diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index 82c736266d..1b0e03cb2a 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -188,6 +188,7 @@ LLWorkerClass::LLWorkerClass(LLWorkerThread* workerthread, const std::string& na : mWorkerThread(workerthread), mWorkerClassName(name), mRequestHandle(LLWorkerThread::nullHandle()), + mRequestPriority(LLWorkerThread::PRIORITY_NORMAL), mMutex(NULL), mWorkFlags(0) { |