Changed Avatar picker to use coroutine for find.

Fixed a stray reference (&) on URL that had crept into some coroutine definitions.
meow-7.2.2
Rider Linden 2015-05-18 16:18:07 -07:00
parent 5fbd84a210
commit a4741cecb2
12 changed files with 44 additions and 44 deletions

View File

@ -747,7 +747,7 @@ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::str
}
/*static*/
void HttpCoroutineAdapter::trivialGetCoro(LLCoros::self& self, std::string &url, completionCallback_t success, completionCallback_t failure)
void HttpCoroutineAdapter::trivialGetCoro(LLCoros::self& self, std::string url, completionCallback_t success, completionCallback_t failure)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
@ -799,7 +799,7 @@ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &p
}
/*static*/
void HttpCoroutineAdapter::trivialPostCoro(LLCoros::self& self, std::string &url, LLSD postData, completionCallback_t success, completionCallback_t failure)
void HttpCoroutineAdapter::trivialPostCoro(LLCoros::self& self, std::string url, LLSD postData, completionCallback_t success, completionCallback_t failure)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t

View File

@ -438,8 +438,8 @@ private:
const std::string & url, LLCore::HttpOptions::ptr_t &options,
LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler);
static void trivialGetCoro(LLCoros::self& self, std::string &url, completionCallback_t success, completionCallback_t failure);
static void trivialPostCoro(LLCoros::self& self, std::string &url, LLSD postData, completionCallback_t success, completionCallback_t failure);
static void trivialGetCoro(LLCoros::self& self, std::string url, completionCallback_t success, completionCallback_t failure);
static void trivialPostCoro(LLCoros::self& self, std::string url, LLSD postData, completionCallback_t success, completionCallback_t failure);
std::string mAdapterName;
LLCore::HttpRequest::priority_t mPriority;

View File

@ -52,6 +52,7 @@
#include "llfocusmgr.h"
#include "lldraghandle.h"
#include "message.h"
#include "llcorehttputil.h"
//#include "llsdserialize.h"
@ -456,39 +457,33 @@ BOOL LLFloaterAvatarPicker::visibleItemsSelected() const
return FALSE;
}
class LLAvatarPickerResponder : public LLHTTPClient::Responder
/*static*/
void LLFloaterAvatarPicker::findCoro(LLCoros::self& self, std::string url, LLUUID queryID, std::string name)
{
LOG_CLASS(LLAvatarPickerResponder);
public:
LLUUID mQueryID;
std::string mName;
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLAvatarPickerResponder(const LLUUID& id, const std::string& name) : mQueryID(id), mName(name) { }
LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL;
protected:
/*virtual*/ void httpCompleted()
{
//std::ostringstream ss;
//LLSDSerialize::toPrettyXML(content, ss);
//LL_INFOS() << ss.str() << LL_ENDL;
LLSD result = httpAdapter->getAndYield(self, httpRequest, url);
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (status || (status == LLCore::HttpStatus(HTTP_BAD_REQUEST)))
{
LLFloaterAvatarPicker* floater =
LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker", name);
if (floater)
{
result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
floater->processResponse(queryID, result);
}
}
}
// in case of invalid characters, the avatar picker returns a 400
// just set it to process so it displays 'not found'
if (isGoodStatus() || getStatus() == HTTP_BAD_REQUEST)
{
LLFloaterAvatarPicker* floater =
LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker", mName);
if (floater)
{
floater->processResponse(mQueryID, getContent());
}
}
else
{
LL_WARNS() << "avatar picker failed " << dumpResponse() << LL_ENDL;
}
}
};
void LLFloaterAvatarPicker::find()
{
@ -517,7 +512,9 @@ void LLFloaterAvatarPicker::find()
std::replace(text.begin(), text.end(), '.', ' ');
url += LLURI::escape(text);
LL_INFOS() << "avatar picker " << url << LL_ENDL;
LLHTTPClient::get(url, new LLAvatarPickerResponder(mQueryID, getKey().asString()));
LLCoros::instance().launch("LLFloaterAvatarPicker::findCoro",
boost::bind(&LLFloaterAvatarPicker::findCoro, _1, url, mQueryID, getKey().asString()));
}
else
{

View File

@ -28,6 +28,8 @@
#define LLFLOATERAVATARPICKER_H
#include "llfloater.h"
#include "lleventcoro.h"
#include "llcoros.h"
#include <vector>
@ -84,6 +86,7 @@ private:
void populateFriend();
BOOL visibleItemsSelected() const; // Returns true if any items in the current tab are selected.
static void findCoro(LLCoros::self& self, std::string url, LLUUID mQueryID, std::string mName);
void find();
void setAllowMultiple(BOOL allow_multiple);
LLScrollListCtrl* getActiveList();

View File

@ -2182,7 +2182,7 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const
return text;
}
void LLVOAvatarSelf::appearanceChangeMetricsCoro(LLCoros::self& self, std::string &url)
void LLVOAvatarSelf::appearanceChangeMetricsCoro(LLCoros::self& self, std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t

View File

@ -402,7 +402,7 @@ private:
F32 mDebugBakedTextureTimes[LLAvatarAppearanceDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
void debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
void appearanceChangeMetricsCoro(LLCoros::self& self, std::string &url);
void appearanceChangeMetricsCoro(LLCoros::self& self, std::string url);
bool mInitialMetric;
S32 mMetricSequence;
/** Diagnostics

View File

@ -605,7 +605,7 @@ void LLVoiceChannelGroup::setState(EState state)
}
}
void LLVoiceChannelGroup::voiceCallCapCoro(LLCoros::self& self, std::string &url)
void LLVoiceChannelGroup::voiceCallCapCoro(LLCoros::self& self, std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t

View File

@ -159,7 +159,7 @@ protected:
virtual void setState(EState state);
private:
void voiceCallCapCoro(LLCoros::self& self, std::string &url);
void voiceCallCapCoro(LLCoros::self& self, std::string url);
U32 mRetries;
BOOL mIsRetrying;

View File

@ -452,7 +452,7 @@ void LLVivoxVoiceClient::requestVoiceAccountProvision(S32 retries)
}
}
void LLVivoxVoiceClient::voiceAccountProvisionCoro(LLCoros::self& self, std::string &url, S32 retries)
void LLVivoxVoiceClient::voiceAccountProvisionCoro(LLCoros::self& self, std::string url, S32 retries)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
@ -3933,7 +3933,7 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo()
}
}
void LLVivoxVoiceClient::parcelVoiceInfoRequestCoro(LLCoros::self& self, std::string &url)
void LLVivoxVoiceClient::parcelVoiceInfoRequestCoro(LLCoros::self& self, std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t

View File

@ -636,8 +636,8 @@ protected:
private:
void voiceAccountProvisionCoro(LLCoros::self& self, std::string &url, S32 retries);
void parcelVoiceInfoRequestCoro(LLCoros::self& self, std::string &url);
void voiceAccountProvisionCoro(LLCoros::self& self, std::string url, S32 retries);
void parcelVoiceInfoRequestCoro(LLCoros::self& self, std::string url);
LLVoiceVersionInfo mVoiceVersion;

View File

@ -127,7 +127,7 @@ void LLUpdateChecker::Implementation::checkVersion(std::string const & urlBase,
}
}
void LLUpdateChecker::Implementation::checkVersionCoro(LLCoros::self& self, std::string &url)
void LLUpdateChecker::Implementation::checkVersionCoro(LLCoros::self& self, std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t

View File

@ -107,7 +107,7 @@ private:
unsigned char uniqueid[MD5HEX_STR_SIZE],
bool willing_to_test);
void checkVersionCoro(LLCoros::self& self, std::string &url);
void checkVersionCoro(LLCoros::self& self, std::string url);
LOG_CLASS(LLUpdateChecker::Implementation);
};