From 075a7bcc980b0ca0d2888d344b6afa8ab5b52d85 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 18 Jul 2013 15:09:45 -0700 Subject: SH-4297 WIP interesting: viewer-interesting starts loading cached scene late dependency cleanup - removed a lot of unecessary includes --- indra/llappearance/llavatarappearance.cpp | 1 + indra/llappearance/llwearable.cpp | 1 + indra/llcommon/llevent.h | 1 - indra/llcommon/llinstancetracker.h | 3 -- indra/llcommon/llmutex.h | 21 ++++---- indra/llcommon/llpointer.h | 79 ++++++++++++++++++++++++++++++ indra/llcommon/llptrto.h | 1 - indra/llcommon/llsdparam.cpp | 1 + indra/llcommon/llthread.h | 81 +------------------------------ indra/llcommon/lltrace.h | 3 ++ indra/llcommon/llunit.h | 26 +++++++--- indra/llimage/llimage.cpp | 2 +- indra/llimage/llimage.h | 2 +- indra/llimage/llimagedimensionsinfo.cpp | 4 +- indra/llimage/llimagedimensionsinfo.h | 2 + indra/llimage/llimagej2c.cpp | 1 + indra/llimage/llimagejpeg.h | 1 + indra/llmessage/llcurl.h | 1 - indra/llui/llflashtimer.h | 1 + indra/llui/llrngwriter.cpp | 1 + indra/llui/llxuiparser.cpp | 1 + indra/llxml/llxmlnode.h | 1 - indra/newview/llappviewer.h | 2 +- indra/newview/llsecapi.h | 3 +- indra/newview/llviewerstats.h | 17 ++++--- 25 files changed, 140 insertions(+), 117 deletions(-) (limited to 'indra') diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index 35d1a8b247..0e91cd3185 100644 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -44,6 +44,7 @@ #include "llstl.h" #include "lltexglobalcolor.h" #include "llwearabledata.h" +#include "boost/bind.hpp" #if LL_MSVC diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index d86a460511..cb80313b0b 100644 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -33,6 +33,7 @@ #include "llvisualparam.h" #include "llavatarappearancedefines.h" #include "llwearable.h" +#include "boost/bind.hpp" using namespace LLAvatarAppearanceDefines; diff --git a/indra/llcommon/llevent.h b/indra/llcommon/llevent.h index 8cd682b8bf..9d3a7a654a 100755 --- a/indra/llcommon/llevent.h +++ b/indra/llcommon/llevent.h @@ -30,7 +30,6 @@ #include "llsd.h" #include "llpointer.h" -#include "llthread.h" namespace LLOldEvents { diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h index c8e1d9cd84..f4e37d21fe 100755 --- a/indra/llcommon/llinstancetracker.h +++ b/indra/llcommon/llinstancetracker.h @@ -32,9 +32,6 @@ #include #include "string_table.h" -#include -#include -#include #include #include diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h index cbde4c47a9..db5b9357d9 100644 --- a/indra/llcommon/llmutex.h +++ b/indra/llcommon/llmutex.h @@ -27,13 +27,16 @@ #ifndef LL_LLMUTEX_H #define LL_LLMUTEX_H -#include "llapr.h" -#include "apr_thread_cond.h" +#include "stdtypes.h" //============================================================================ #define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO) +struct apr_thread_mutex_t; +struct apr_pool_t; +struct apr_thread_cond_t; + class LL_COMMON_API LLMutex { public: @@ -45,18 +48,18 @@ public: LLMutex(apr_pool_t *apr_poolp = NULL); // NULL pool constructs a new pool for the mutex virtual ~LLMutex(); - void lock(); // blocks + void lock(); // blocks void unlock(); - bool isLocked(); // non-blocking, but does do a lock/unlock so not free - bool isSelfLocked(); //return true if locked in a same thread + bool isLocked(); // non-blocking, but does do a lock/unlock so not free + bool isSelfLocked(); //return true if locked in a same thread U32 lockingThread() const; //get ID of locking thread protected: - apr_thread_mutex_t *mAPRMutexp; + apr_thread_mutex_t* mAPRMutexp; mutable U32 mCount; mutable U32 mLockingThread; - apr_pool_t *mAPRPoolp; + apr_pool_t* mAPRPoolp; BOOL mIsLocalPool; #if MUTEX_DEBUG @@ -68,7 +71,7 @@ protected: class LL_COMMON_API LLCondition : public LLMutex { public: - LLCondition(apr_pool_t *apr_poolp); // Defaults to global pool, could use the thread pool as well. + LLCondition(apr_pool_t* apr_poolp); // Defaults to global pool, could use the thread pool as well. ~LLCondition(); void wait(); // blocks @@ -76,7 +79,7 @@ public: void broadcast(); protected: - apr_thread_cond_t *mAPRCondp; + apr_thread_cond_t* mAPRCondp; }; class LLMutexLock diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index c827996db1..9a0726c338 100755 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -27,6 +27,7 @@ #define LLPOINTER_H #include "llerror.h" // *TODO: consider eliminating this +#include "llmutex.h" //---------------------------------------------------------------------------- // RefCount objects should generally only be accessed by way of LLPointer<>'s @@ -213,4 +214,82 @@ private: bool mStayUnique; }; +//============================================================================ + +// see llmemory.h for LLPointer<> definition + +class LL_COMMON_API LLThreadSafeRefCount +{ +public: + static void initThreadSafeRefCount(); // creates sMutex + static void cleanupThreadSafeRefCount(); // destroys sMutex + +private: + static LLMutex* sMutex; + +protected: + virtual ~LLThreadSafeRefCount(); // use unref() + +public: + LLThreadSafeRefCount(); + LLThreadSafeRefCount(const LLThreadSafeRefCount&); + LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) + { + if (sMutex) + { + sMutex->lock(); + } + mRef = 0; + if (sMutex) + { + sMutex->unlock(); + } + return *this; + } + + void ref() + { + if (sMutex) sMutex->lock(); + mRef++; + if (sMutex) sMutex->unlock(); + } + + S32 unref() + { + llassert(mRef >= 1); + if (sMutex) sMutex->lock(); + S32 res = --mRef; + if (sMutex) sMutex->unlock(); + if (0 == res) + { + delete this; + return 0; + } + return res; + } + S32 getNumRefs() const + { + return mRef; + } + +private: + S32 mRef; +}; + +/** + * intrusive pointer support for LLThreadSafeRefCount + * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type + */ +namespace boost +{ + inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) + { + p->ref(); + } + + inline void intrusive_ptr_release(LLThreadSafeRefCount* p) + { + p->unref(); + } +}; #endif diff --git a/indra/llcommon/llptrto.h b/indra/llcommon/llptrto.h index 7091d36f6b..4082e30de6 100755 --- a/indra/llcommon/llptrto.h +++ b/indra/llcommon/llptrto.h @@ -33,7 +33,6 @@ #include "llpointer.h" #include "llrefcount.h" // LLRefCount -#include "llthread.h" // LLThreadSafeRefCount #include #include #include diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index 50815b2cc6..c1ba777543 100755 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -30,6 +30,7 @@ // Project includes #include "llsdparam.h" #include "llsdutil.h" +#include "boost/bind.hpp" static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 4a84a14a65..c2c6b8e7ac 100755 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -32,6 +32,7 @@ #include "apr_thread_cond.h" #include "boost/intrusive_ptr.hpp" #include "llmutex.h" +#include "llpointer.h" LL_COMMON_API void assert_main_thread(); @@ -148,86 +149,6 @@ void LLThread::unlockData() //============================================================================ -// see llmemory.h for LLPointer<> definition - -class LL_COMMON_API LLThreadSafeRefCount -{ -public: - static void initThreadSafeRefCount(); // creates sMutex - static void cleanupThreadSafeRefCount(); // destroys sMutex - -private: - static LLMutex* sMutex; - -protected: - virtual ~LLThreadSafeRefCount(); // use unref() - -public: - LLThreadSafeRefCount(); - LLThreadSafeRefCount(const LLThreadSafeRefCount&); - LLThreadSafeRefCount& operator=(const LLThreadSafeRefCount& ref) - { - if (sMutex) - { - sMutex->lock(); - } - mRef = 0; - if (sMutex) - { - sMutex->unlock(); - } - return *this; - } - - - - void ref() - { - if (sMutex) sMutex->lock(); - mRef++; - if (sMutex) sMutex->unlock(); - } - - S32 unref() - { - llassert(mRef >= 1); - if (sMutex) sMutex->lock(); - S32 res = --mRef; - if (sMutex) sMutex->unlock(); - if (0 == res) - { - delete this; - return 0; - } - return res; - } - S32 getNumRefs() const - { - return mRef; - } - -private: - S32 mRef; -}; - -/** - * intrusive pointer support for LLThreadSafeRefCount - * this allows you to use boost::intrusive_ptr with any LLThreadSafeRefCount-derived type - */ -namespace boost -{ - inline void intrusive_ptr_add_ref(LLThreadSafeRefCount* p) - { - p->ref(); - } - - inline void intrusive_ptr_release(LLThreadSafeRefCount* p) - { - p->unref(); - } -}; -//============================================================================ - // Simple responder for self destructing callbacks // Pure virtual class class LL_COMMON_API LLResponder : public LLThreadSafeRefCount diff --git a/indra/llcommon/lltrace.h b/indra/llcommon/lltrace.h index 2c84b1596a..75e913a348 100644 --- a/indra/llcommon/lltrace.h +++ b/indra/llcommon/lltrace.h @@ -123,6 +123,7 @@ class EventStatHandle public: typedef F64 storage_t; typedef TraceType trace_t; + typedef EventStatHandle self_t; EventStatHandle(const char* name, const char* description = NULL) : trace_t(name, description) @@ -146,6 +147,7 @@ class SampleStatHandle public: typedef F64 storage_t; typedef TraceType trace_t; + typedef SampleStatHandle self_t; SampleStatHandle(const char* name, const char* description = NULL) : trace_t(name, description) @@ -168,6 +170,7 @@ class CountStatHandle public: typedef F64 storage_t; typedef TraceType trace_t; + typedef CountStatHandle self_t; CountStatHandle(const char* name, const char* description = NULL) : trace_t(name, description) diff --git a/indra/llcommon/llunit.h b/indra/llcommon/llunit.h index 79465715cf..731cc0eded 100644 --- a/indra/llcommon/llunit.h +++ b/indra/llcommon/llunit.h @@ -30,12 +30,12 @@ #include "stdtypes.h" #include "llpreprocessor.h" #include "llerrorlegacy.h" -#include template struct LLUnit { typedef LLUnit self_t; + typedef STORAGE_TYPE storage_t; // value initialization @@ -163,18 +163,28 @@ struct LLUnitImplicit : public LLUnit }; +template +struct LLIsSameType +{ + static const bool value = false; +}; + +template +struct LLIsSameType +{ + static const bool value = true; +}; + template LL_FORCE_INLINE void ll_convert_units(LLUnit in, LLUnit& out, ...) { - typedef boost::integral_constant::value - || !boost::is_same::value - || !boost::is_same::value> conversion_valid_t; - LL_STATIC_ASSERT(conversion_valid_t::value, "invalid conversion"); + LL_STATIC_ASSERT((LLIsSameType::value + || !LLIsSameType::value + || !LLIsSameType::value), "invalid conversion"); - if (boost::is_same::value) + if (LLIsSameType::value) { - if (boost::is_same::value) + if (LLIsSameType::value) { // T1 and T2 fully reduced and equal...just copy diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 8477e62db7..655d7a381a 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -26,6 +26,7 @@ #include "linden_common.h" +#include "llimageworker.h" #include "llimage.h" #include "llmath.h" @@ -37,7 +38,6 @@ #include "llimagejpeg.h" #include "llimagepng.h" #include "llimagedxt.h" -#include "llimageworker.h" #include "llmemory.h" //--------------------------------------------------------------------------- diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 504b7e4795..8ad6b49dd2 100755 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -29,7 +29,7 @@ #include "lluuid.h" #include "llstring.h" -#include "llthread.h" +#include "llpointer.h" #include "lltrace.h" const S32 MIN_IMAGE_MIP = 2; // 4x4, only used for expand/contract power of 2 diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index c6bfa50b40..383ae00fb7 100755 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -172,8 +172,8 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg() /* Make sure this is a JPEG file. */ const size_t JPEG_MAGIC_SIZE = 2; - const uint8_t jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; - uint8_t signature[JPEG_MAGIC_SIZE]; + const U8 jpeg_magic[JPEG_MAGIC_SIZE] = {0xFF, 0xD8}; + U8 signature[JPEG_MAGIC_SIZE]; if (fread(signature, sizeof(signature), 1, fp) != 1) { diff --git a/indra/llimage/llimagedimensionsinfo.h b/indra/llimage/llimagedimensionsinfo.h index 382fdb2a0e..8f716c5d02 100755 --- a/indra/llimage/llimagedimensionsinfo.h +++ b/indra/llimage/llimagedimensionsinfo.h @@ -27,6 +27,8 @@ #ifndef LL_LLIMAGEDIMENSIONSINFO_H #define LL_LLIMAGEDIMENSIONSINFO_H +#include "llapr.h" + //----------------------------------------------------------------------------- // LLImageDimensionsInfo // helper class to get image dimensions WITHOUT loading image to memore diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 5412f98ee5..65cdcd6923 100755 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -24,6 +24,7 @@ */ #include "linden_common.h" +#include "llapr.h" #include "lldir.h" #include "llimagej2c.h" #include "lltimer.h" diff --git a/indra/llimage/llimagejpeg.h b/indra/llimage/llimagejpeg.h index 7ac7f5d2e0..5b596d9fa4 100755 --- a/indra/llimage/llimagejpeg.h +++ b/indra/llimage/llimagejpeg.h @@ -31,6 +31,7 @@ #include "llimage.h" +#include "llwin32headerslean.h" extern "C" { #ifdef LL_STANDALONE # include diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 7bcf61e233..1c88800ffa 100755 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -41,7 +41,6 @@ #include "llbuffer.h" #include "lliopipe.h" #include "llsd.h" -#include "llthread.h" #include "llqueuedthread.h" #include "llframetimer.h" #include "llpointer.h" diff --git a/indra/llui/llflashtimer.h b/indra/llui/llflashtimer.h index c60f99a8ea..db8d49f009 100755 --- a/indra/llui/llflashtimer.h +++ b/indra/llui/llflashtimer.h @@ -28,6 +28,7 @@ #define LL_FLASHTIMER_H #include "lleventtimer.h" +#include "boost/function.hpp" class LLFlashTimer : public LLEventTimer { diff --git a/indra/llui/llrngwriter.cpp b/indra/llui/llrngwriter.cpp index 5e6840d7df..cd9fe3610e 100755 --- a/indra/llui/llrngwriter.cpp +++ b/indra/llui/llrngwriter.cpp @@ -29,6 +29,7 @@ #include "llrngwriter.h" #include "lluicolor.h" #include "lluictrlfactory.h" +#include "boost/bind.hpp" static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 2814efec47..4cbf84be73 100755 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -38,6 +38,7 @@ #include #include +#include //#include #include diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h index ec486d7957..d7681c54a0 100755 --- a/indra/llxml/llxmlnode.h +++ b/indra/llxml/llxmlnode.h @@ -39,7 +39,6 @@ #include "indra_constants.h" #include "llpointer.h" -#include "llthread.h" // LLThreadSafeRefCount #include "llstring.h" #include "llstringtable.h" #include "llfile.h" diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 68e9ebeff3..e7dd605044 100755 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -271,7 +271,7 @@ private: LLWatchdogTimeout* mMainloopTimeout; // For performance and metric gathering - LLThread* mFastTimerLogThread; + class LLThread* mFastTimerLogThread; // for tracking viewer<->region circuit death bool mAgentRegionLastAlive; diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h index 28765fbfb1..c01d318f56 100755 --- a/indra/newview/llsecapi.h +++ b/indra/newview/llsecapi.h @@ -28,9 +28,10 @@ #ifndef LLSECAPI_H #define LLSECAPI_H #include +#include "llwin32headerslean.h" #include #include -#include "llthread.h" +#include "llpointer.h" #ifdef LL_WINDOWS #pragma warning(disable:4250) diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 3b7079ae4b..ee1a73de9f 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -48,6 +48,8 @@ struct SimMeasurementSampler : public LLInstanceTracker struct SimMeasurement : public LLTrace::SampleStatHandle, public SimMeasurementSampler { + typedef SimMeasurement self_t; + SimMeasurement(const char* name, const char* description, ESimStatID stat_id) : LLTrace::SampleStatHandle(name, description), SimMeasurementSampler(stat_id) @@ -55,17 +57,18 @@ struct SimMeasurement : public LLTrace::SampleStatHandle, public SimMeasureme using SimMeasurementSampler::getInstance; + //friend void sample(self_t& measurement, T value) + //{ + // LLTrace::sample(static_cast& >(measurement), value); + //} + /*virtual*/ void sample(F64 value) { - LLTrace::sample(*this, value); + LLTrace::sample(static_cast& >(*this), value); + //LLStatViewer::sample(*this, value); } -}; -template -void sample(SimMeasurement& measurement, VALUE_T value) -{ - LLTrace::sample(measurement, value); -} +}; extern LLTrace::CountStatHandle<> FPS, PACKETS_IN, -- cgit v1.2.3