summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-x[-rw-r--r--]indra/llcommon/llfasttimer_class.h6
-rwxr-xr-x[-rw-r--r--]indra/llcommon/llthread.cpp2
-rwxr-xr-x[-rw-r--r--]indra/newview/llappearancemgr.cpp69
-rwxr-xr-x[-rw-r--r--]indra/newview/llappearancemgr.h9
-rwxr-xr-x[-rw-r--r--]indra/newview/llcallbacklist.cpp65
-rwxr-xr-x[-rw-r--r--]indra/newview/llcallbacklist.h9
-rwxr-xr-xindra/newview/llfloatermodelpreview.cpp29
-rwxr-xr-x[-rw-r--r--]indra/newview/llfloatermodelpreview.h2
8 files changed, 102 insertions, 89 deletions
diff --git a/indra/llcommon/llfasttimer_class.h b/indra/llcommon/llfasttimer_class.h
index 2a645315c9..038a2d246a 100644..100755
--- a/indra/llcommon/llfasttimer_class.h
+++ b/indra/llcommon/llfasttimer_class.h
@@ -31,16 +31,14 @@
#define FAST_TIMER_ON 1
#define TIME_FAST_TIMERS 0
-#define DEBUG_FAST_TIMER_THREADS 0
+#define DEBUG_FAST_TIMER_THREADS 1
class LLMutex;
#include <queue>
#include "llsd.h"
-#if DEBUG_FAST_TIMER_THREADS
-void assert_main_thread();
-#endif
+LL_COMMON_API void assert_main_thread();
class LL_COMMON_API LLFastTimer
{
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index f0b7ac5def..b4617c5453 100644..100755
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -62,7 +62,7 @@ U32 ll_thread_local sThreadID = 0;
U32 LLThread::sIDIter = 0;
-void assert_main_thread()
+LL_COMMON_API void assert_main_thread()
{
static U32 s_thread_id = LLThread::currentID();
if (LLThread::currentID() != s_thread_id)
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 80734b0d41..0e080e713b 100644..100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2759,75 +2759,6 @@ BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const
*/
}
-// Shim class to allow arbitrary boost::bind
-// expressions to be run as one-time idle callbacks.
-//
-// TODO: rework idle function spec to take a boost::function in the first place.
-class OnIdleCallbackOneTime
-{
-public:
- OnIdleCallbackOneTime(nullary_func_t callable):
- mCallable(callable)
- {
- }
- static void onIdle(void *data)
- {
- gIdleCallbacks.deleteFunction(onIdle, data);
- OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data);
- self->call();
- delete self;
- }
- void call()
- {
- mCallable();
- }
-private:
- nullary_func_t mCallable;
-};
-
-void doOnIdleOneTime(nullary_func_t callable)
-{
- OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable);
- gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor);
-}
-
-// Shim class to allow generic boost functions to be run as
-// recurring idle callbacks. Callable should return true when done,
-// false to continue getting called.
-//
-// TODO: rework idle function spec to take a boost::function in the first place.
-class OnIdleCallbackRepeating
-{
-public:
- OnIdleCallbackRepeating(bool_func_t callable):
- mCallable(callable)
- {
- }
- // Will keep getting called until the callable returns true.
- static void onIdle(void *data)
- {
- OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data);
- bool done = self->call();
- if (done)
- {
- gIdleCallbacks.deleteFunction(onIdle, data);
- delete self;
- }
- }
- bool call()
- {
- return mCallable();
- }
-private:
- bool_func_t mCallable;
-};
-
-void doOnIdleRepeating(bool_func_t callable)
-{
- OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable);
- gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
-}
-
class CallAfterCategoryFetchStage2: public LLInventoryFetchItemsObserver
{
public:
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index c65d9dc9ee..4b1d95cf25 100644..100755
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -248,15 +248,6 @@ private:
LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string& name);
-typedef boost::function<void ()> nullary_func_t;
-typedef boost::function<bool ()> bool_func_t;
-
-// Call a given callable once in idle loop.
-void doOnIdleOneTime(nullary_func_t callable);
-
-// Repeatedly call a callable in idle loop until it returns true.
-void doOnIdleRepeating(bool_func_t callable);
-
// Invoke a given callable after category contents are fully fetched.
void callAfterCategoryFetch(const LLUUID& cat_id, nullary_func_t cb);
diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp
index a54c77b4a0..357a6582d1 100644..100755
--- a/indra/newview/llcallbacklist.cpp
+++ b/indra/newview/llcallbacklist.cpp
@@ -115,6 +115,71 @@ void LLCallbackList::callFunctions()
}
}
+// Shim class to allow arbitrary boost::bind
+// expressions to be run as one-time idle callbacks.
+class OnIdleCallbackOneTime
+{
+public:
+ OnIdleCallbackOneTime(nullary_func_t callable):
+ mCallable(callable)
+ {
+ }
+ static void onIdle(void *data)
+ {
+ gIdleCallbacks.deleteFunction(onIdle, data);
+ OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data);
+ self->call();
+ delete self;
+ }
+ void call()
+ {
+ mCallable();
+ }
+private:
+ nullary_func_t mCallable;
+};
+
+void doOnIdleOneTime(nullary_func_t callable)
+{
+ OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable);
+ gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor);
+}
+
+// Shim class to allow generic boost functions to be run as
+// recurring idle callbacks. Callable should return true when done,
+// false to continue getting called.
+class OnIdleCallbackRepeating
+{
+public:
+ OnIdleCallbackRepeating(bool_func_t callable):
+ mCallable(callable)
+ {
+ }
+ // Will keep getting called until the callable returns true.
+ static void onIdle(void *data)
+ {
+ OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data);
+ bool done = self->call();
+ if (done)
+ {
+ gIdleCallbacks.deleteFunction(onIdle, data);
+ delete self;
+ }
+ }
+ bool call()
+ {
+ return mCallable();
+ }
+private:
+ bool_func_t mCallable;
+};
+
+void doOnIdleRepeating(bool_func_t callable)
+{
+ OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable);
+ gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor);
+}
+
#ifdef _DEBUG
void test1(void *data)
diff --git a/indra/newview/llcallbacklist.h b/indra/newview/llcallbacklist.h
index 07ac21f5e9..97f3bfd9ee 100644..100755
--- a/indra/newview/llcallbacklist.h
+++ b/indra/newview/llcallbacklist.h
@@ -52,6 +52,15 @@ protected:
callback_list_t mCallbackList;
};
+typedef boost::function<void ()> nullary_func_t;
+typedef boost::function<bool ()> bool_func_t;
+
+// Call a given callable once in idle loop.
+void doOnIdleOneTime(nullary_func_t callable);
+
+// Repeatedly call a callable in idle loop until it returns true.
+void doOnIdleRepeating(bool_func_t callable);
+
extern LLCallbackList gIdleCallbacks;
#endif
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 660157df1e..f9648b0e3b 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -94,8 +94,7 @@
#include "lltoggleablemenu.h"
#include "llvfile.h"
#include "llvfs.h"
-
-
+#include "llcallbacklist.h"
#include "glod/glod.h"
@@ -1600,8 +1599,8 @@ void LLModelLoader::run()
}
processElement(scene);
-
- mPreview->loadModelCallback(mLod);
+
+ doOnIdleOneTime(boost::bind(&LLModelPreview::loadModelCallback,mPreview,mLod));
}
}
@@ -2053,6 +2052,8 @@ LLModelPreview::~LLModelPreview()
U32 LLModelPreview::calcResourceCost()
{
+ assert_main_thread();
+
rebuildUploadData();
if ( mModelLoader->getLoadState() != LLModelLoader::ERROR_PARSING )
@@ -2134,6 +2135,8 @@ U32 LLModelPreview::calcResourceCost()
void LLModelPreview::rebuildUploadData()
{
+ assert_main_thread();
+
mUploadData.clear();
mTextureSet.clear();
@@ -2256,6 +2259,8 @@ void LLModelPreview::clearModel(S32 lod)
void LLModelPreview::loadModel(std::string filename, S32 lod)
{
+ assert_main_thread();
+
LLMutexLock lock(this);
if (mModelLoader)
@@ -2311,6 +2316,8 @@ void LLModelPreview::loadModel(std::string filename, S32 lod)
void LLModelPreview::setPhysicsFromLOD(S32 lod)
{
+ assert_main_thread();
+
if (lod >= 0 && lod <= 3)
{
mModel[LLModel::LOD_PHYSICS] = mModel[lod];
@@ -2366,7 +2373,9 @@ void LLModelPreview::clearGLODGroup()
}
void LLModelPreview::loadModelCallback(S32 lod)
-{ //NOT the main thread
+{
+ assert_main_thread();
+
LLMutexLock lock(this);
if (!mModelLoader)
{
@@ -2421,6 +2430,8 @@ void LLModelPreview::resetPreviewTarget()
void LLModelPreview::generateNormals()
{
+ assert_main_thread();
+
S32 which_lod = mPreviewLOD;
@@ -3063,6 +3074,8 @@ void LLModelPreview::genLODs(S32 which_lod)
void LLModelPreview::updateStatusMessages()
{
+ assert_main_thread();
+
//triangle/vertex/submesh count for each mesh asset for each lod
std::vector<S32> tris[LLModel::NUM_LODS];
std::vector<S32> verts[LLModel::NUM_LODS];
@@ -3576,6 +3589,8 @@ void LLModelPreview::update()
//-----------------------------------------------------------------------------
BOOL LLModelPreview::render()
{
+ assert_main_thread();
+
LLMutexLock lock(this);
mNeedsUpdate = FALSE;
@@ -4141,6 +4156,8 @@ void LLModelPreview::setPreviewLOD(S32 lod)
//static
void LLFloaterModelPreview::onBrowseLOD(void* data)
{
+ assert_main_thread();
+
LLFloaterModelPreview* mp = (LLFloaterModelPreview*) data;
mp->loadModel(mp->mModelPreview->mPreviewLOD);
}
@@ -4148,6 +4165,8 @@ void LLFloaterModelPreview::onBrowseLOD(void* data)
//static
void LLFloaterModelPreview::onUpload(void* user_data)
{
+ assert_main_thread();
+
LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data;
mp->mModelPreview->rebuildUploadData();
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index e233f3672a..ae4cf18fee 100644..100755
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -278,7 +278,7 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
friend class LLFloaterModelPreview::DecompRequest;
friend class LLPhysicsDecomp;
- LLFloater* mFMP;
+ LLFloater* mFMP;
BOOL mNeedsUpdate;
bool mDirty;