From a455759e643ef3b285f8fa38d2a7c9db74605c44 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 26 Aug 2015 15:50:15 -0700 Subject: Convert exp floater to use coroutines Convert script queue compilation exp request --- indra/newview/llcompilequeue.cpp | 49 +++++++++++++++------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) (limited to 'indra/newview/llcompilequeue.cpp') diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 24e662ee50..9545771c8d 100755 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -61,6 +61,7 @@ #include "llexperiencecache.h" #include "llviewerassetupload.h" +#include "llcorehttputil.h" // *NOTE$: A minor specialization of LLScriptAssetUpload, it does not require a buffer // (and does not save a buffer to the vFS) and it finds the compile queue window and @@ -283,35 +284,6 @@ BOOL LLFloaterScriptQueue::startQueue() return nextObject(); } -class CompileQueueExperienceResponder : public LLHTTPClient::Responder -{ -public: - CompileQueueExperienceResponder(const LLUUID& parent):mParent(parent) - { - } - - LLUUID mParent; - - /*virtual*/ void httpSuccess() - { - sendResult(getContent()); - } - /*virtual*/ void httpFailure() - { - sendResult(LLSD()); - } - void sendResult(const LLSD& content) - { - LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", mParent); - if(!queue) - return; - - queue->experienceIdsReceived(content["experience_ids"]); - } -}; - - - ///---------------------------------------------------------------------------- /// Class LLFloaterCompileQueue @@ -675,14 +647,29 @@ BOOL LLFloaterCompileQueue::startQueue() std::string lookup_url=region->getCapability("GetCreatorExperiences"); if(!lookup_url.empty()) { - LLHTTPClient::get(lookup_url, new CompileQueueExperienceResponder(getKey().asUUID())); - return TRUE; + LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t success = + boost::bind(&LLFloaterCompileQueue::processExperienceIdResults, _1, getKey().asUUID()); + + LLCoreHttpUtil::HttpCoroutineAdapter::completionCallback_t failure = + boost::bind(&LLFloaterCompileQueue::processExperienceIdResults, LLSD(), getKey().asUUID()); + + LLCoreHttpUtil::HttpCoroutineAdapter::callbackHttpGet(lookup_url, + success, failure); + return TRUE; } } return nextObject(); } +/*static*/ +void LLFloaterCompileQueue::processExperienceIdResults(LLSD result, LLUUID parent) +{ + LLFloaterCompileQueue* queue = LLFloaterReg::findTypedInstance("compile_queue", parent); + if (!queue) + return; + queue->experienceIdsReceived(result["experience_ids"]); +} void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv) -- cgit v1.2.3