diff options
| author | Kitty Barnett <develop@catznip.com> | 2012-12-03 15:46:49 +0100 | 
|---|---|---|
| committer | Kitty Barnett <develop@catznip.com> | 2012-12-03 15:46:49 +0100 | 
| commit | 1e194eb412bb10c1733ed76e270e45578ac15e0b (patch) | |
| tree | f4201c8a754f5dcd5b0ffc5d4dd45b72eded23c6 /indra | |
| parent | 25bffc3d43ec7696c0a9fab43514affbfe006fb9 (diff) | |
Handle delayed requesting and sending of materials through an idle callback
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llfloaterdebugmaterials.cpp | 3 | ||||
| -rw-r--r-- | indra/newview/llmaterialmgr.cpp | 22 | ||||
| -rw-r--r-- | indra/newview/llmaterialmgr.h | 5 | 
3 files changed, 25 insertions, 5 deletions
diff --git a/indra/newview/llfloaterdebugmaterials.cpp b/indra/newview/llfloaterdebugmaterials.cpp index 1ee6bab36b..5ad5ecbdfd 100644 --- a/indra/newview/llfloaterdebugmaterials.cpp +++ b/indra/newview/llfloaterdebugmaterials.cpp @@ -452,7 +452,6 @@ void LLFloaterDebugMaterials::onPostClicked()  			LLMaterialMgr::instance().get(material_id, boost::bind(&LLFloaterDebugMaterials::onGetMaterial, _1, _2));  		} -		LLMaterialMgr::instance().processGetQueue();  	}  } @@ -731,8 +730,6 @@ void LLFloaterDebugMaterials::requestPutMaterials(bool pIsDoSet)  					}  				}  			} - -			LLMaterialMgr::instance().processPutQueue();  		}  	}  } diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 9ee96dccb9..a8731a8c4c 100644 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -29,6 +29,7 @@  #include "llsdserialize.h"  #include "llagent.h" +#include "llcallbacklist.h"  #include "llmaterialmgr.h"  #include "llviewerobject.h"  #include "llviewerobjectlist.h" @@ -105,10 +106,12 @@ void LLMaterialsResponder::error(U32 pStatus, const std::string& pReason)  LLMaterialMgr::LLMaterialMgr()  { +	gIdleCallbacks.addFunction(&LLMaterialMgr::onIdle, NULL);  }  LLMaterialMgr::~LLMaterialMgr()  { +	gIdleCallbacks.deleteFunction(&LLMaterialMgr::onIdle, NULL);  }  bool LLMaterialMgr::isGetPending(const LLMaterialID& material_id) @@ -298,6 +301,25 @@ void LLMaterialMgr::onPutResponse(bool success, const LLSD& content, const LLUUI  	}  } +static LLFastTimer::DeclareTimer FTM_MATERIALS_IDLE("Materials"); + +void LLMaterialMgr::onIdle(void*) +{ +	LLFastTimer t(FTM_MATERIALS_IDLE); + +	LLMaterialMgr* instancep = LLMaterialMgr::getInstance(); + +	if (!instancep->mGetQueue.empty()) +	{ +		instancep->processGetQueue(); +	} + +	if (!instancep->mPutQueue.empty()) +	{ +		instancep->processPutQueue(); +	} +} +  void LLMaterialMgr::processGetQueue()  {  	LLViewerRegion* regionp = gAgent.getRegion(); diff --git a/indra/newview/llmaterialmgr.h b/indra/newview/llmaterialmgr.h index d801d40c36..49d1029522 100644 --- a/indra/newview/llmaterialmgr.h +++ b/indra/newview/llmaterialmgr.h @@ -43,13 +43,14 @@ public:  	const LLMaterialPtr         get(const LLMaterialID& material_id);  	boost::signals2::connection get(const LLMaterialID& material_id, get_callback_t::slot_type cb);  	void put(const LLUUID& object_id, const U8 te, const LLMaterial& material); -	void processGetQueue(); -	void processPutQueue();  protected:  	bool isGetPending(const LLMaterialID& material_id); +	static void onIdle(void*); +	void processGetQueue();  	void onGetResponse(bool success, const LLSD& content); +	void processPutQueue();  	void onPutResponse(bool success, const LLSD& content, const LLUUID& object_id);  protected:  | 
