diff --git a/indra/aistatemachine/aistatemachinethread.h b/indra/aistatemachine/aistatemachinethread.h index bf835c214..9eefd4dca 100644 --- a/indra/aistatemachine/aistatemachinethread.h +++ b/indra/aistatemachine/aistatemachinethread.h @@ -44,8 +44,8 @@ class HelloWorldThread : public AIThreadImpl { public: // Constructor. - HelloWorldThread(AIStateMachineThreadBase* state_machine_thread) : // MAIN THREAD - AIThreadImpl(state_machine_thread, "HelloWorldThread"), mStdErr(false), mSuccess(false) { } + HelloWorldThread(void) : AIThreadImpl("HelloWorldThread"), // MAIN THREAD + mStdErr(false), mSuccess(false) { } // Some initialization function (if needed). void init(bool err) { mStdErr = err; } // MAIN THREAD @@ -152,24 +152,21 @@ class AIStateMachineThreadBase; // Derive from this to implement the code that must run in another thread. class AIThreadImpl : public LLThreadSafeRefCount { private: + template friend struct AIStateMachineThread; typedef AIAccess StateMachineThread_wat; AIThreadSafeSimpleDC mStateMachineThread; -#ifdef LL_DEBUG - char const* mName; -#endif - - protected: - AIThreadImpl(AIStateMachineThreadBase* state_machine_thread, char const* name = "AIStateMachineThreadBase::Thread") : mStateMachineThread(state_machine_thread) -#ifdef LL_DEBUG - , mName(name) -#endif - { } public: virtual bool run(void) = 0; bool thread_done(bool result); bool state_machine_done(LLThread* threadp); + #ifdef LL_DEBUG + private: + char const* mName; + protected: + AIThreadImpl(char const* name = "AIStateMachineThreadBase::Thread") : mName(name) { } + public: char const* getName(void) const { return mName; } #endif }; @@ -221,9 +218,11 @@ template struct AIStateMachineThread : public LLPointer, public AIStateMachineThreadBase { // Constructor. AIStateMachineThread(void) : - LLPointer(new THREAD_IMPL(this)), + LLPointer(new THREAD_IMPL), AIStateMachineThreadBase(LLPointer::get()) - { } + { + *AIThreadImpl::StateMachineThread_wat(static_cast(LLPointer::get())->mStateMachineThread) = this; + } }; #endif diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 0d8e44650..61ebb135d 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1270,10 +1270,6 @@ bool LLMeshRepoThread::physicsShapeReceived(const LLUUID& mesh_id, U8* data, S32 return true; } -LLMeshUploadThread::LLMeshUploadThread(AIStateMachineThreadBase* state_machine_thread) : AIThreadImpl(state_machine_thread, "mesh upload") -{ -} - void LLMeshUploadThread::init(LLMeshUploadThread::instance_list& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool do_upload, LLHandle const& fee_observer, LLHandle const& upload_observer) @@ -1295,11 +1291,6 @@ void LLMeshUploadThread::init(LLMeshUploadThread::instance_list& data, LLVector3 mMeshUploadTimeOut = gSavedSettings.getS32("MeshUploadTimeOut") ; } -LLMeshUploadThread::~LLMeshUploadThread() -{ - -} - LLMeshUploadThread::DecompRequest::DecompRequest(LLModel* mdl, LLModel* base_model, LLMeshUploadThread* thread) { mStage = "single_hull"; diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index b63a32e58..3db85edf9 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -394,10 +394,12 @@ public: LLHost mHost; std::string mWholeModelFeeCapability; - LLMeshUploadThread(AIStateMachineThreadBase* state_machine_thread); - ~LLMeshUploadThread(); +#ifdef LL_DEBUG + LLMeshUploadThread(void) : AIThreadImpl("mesh upload") { } +#endif void init(instance_list& data, LLVector3& scale, bool upload_textures, bool upload_skin, bool upload_joints, bool do_upload, LLHandle const& fee_observer, LLHandle const& upload_observer); + void postRequest(std::string& url, AIMeshUpload* state_machine); /*virtual*/ bool run();