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/newview/llmaterialmgr.cpp | |
parent | 25bffc3d43ec7696c0a9fab43514affbfe006fb9 (diff) |
Handle delayed requesting and sending of materials through an idle callback
Diffstat (limited to 'indra/newview/llmaterialmgr.cpp')
-rw-r--r-- | indra/newview/llmaterialmgr.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
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(); |