diff options
| author | Rider Linden <rider@lindenlab.com> | 2015-05-18 16:18:07 -0700 | 
|---|---|---|
| committer | Rider Linden <rider@lindenlab.com> | 2015-05-18 16:18:07 -0700 | 
| commit | a4741cecb2112f418c1d98ca63a261e707a856c3 (patch) | |
| tree | dc9441dac999f297d8c2bdcee69de5799a60e9bb | |
| parent | 5fbd84a210e84be165d2e5bcf85daf5a22b32f96 (diff) | |
Changed Avatar picker to use coroutine for find.
Fixed a stray reference (&) on URL that had crept into some coroutine definitions.
| -rw-r--r-- | indra/llmessage/llcorehttputil.cpp | 4 | ||||
| -rw-r--r-- | indra/llmessage/llcorehttputil.h | 4 | ||||
| -rwxr-xr-x | indra/newview/llfloateravatarpicker.cpp | 57 | ||||
| -rwxr-xr-x | indra/newview/llfloateravatarpicker.h | 3 | ||||
| -rwxr-xr-x | indra/newview/llvoavatarself.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llvoavatarself.h | 2 | ||||
| -rwxr-xr-x | indra/newview/llvoicechannel.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llvoicechannel.h | 2 | ||||
| -rwxr-xr-x | indra/newview/llvoicevivox.cpp | 4 | ||||
| -rwxr-xr-x | indra/newview/llvoicevivox.h | 4 | ||||
| -rwxr-xr-x | indra/viewer_components/updater/llupdatechecker.cpp | 2 | ||||
| -rwxr-xr-x | indra/viewer_components/updater/llupdatechecker.h | 2 | 
12 files changed, 44 insertions, 44 deletions
| diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index f8f5866355..cf34029dfe 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -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 diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index 73a51fe83a..35e5b0aa2d 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -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; diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 566a3c9cd3..84e3584331 100755 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -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  	{ diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index ed3e51c56f..200f74278e 100755 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -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(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 3c18d11248..0d99c9ac14 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -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 diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 46f92763a2..b3b5fe6c2f 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -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 diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index a609f02710..fd1892e94b 100755 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -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 diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index 13d73a51f8..0dac0b1f6a 100755 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -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; diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6d8f48b705..c70ce5801d 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -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 diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 5e20351e73..f00108050b 100755 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -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; diff --git a/indra/viewer_components/updater/llupdatechecker.cpp b/indra/viewer_components/updater/llupdatechecker.cpp index caeab35999..e5d7d345cb 100755 --- a/indra/viewer_components/updater/llupdatechecker.cpp +++ b/indra/viewer_components/updater/llupdatechecker.cpp @@ -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 diff --git a/indra/viewer_components/updater/llupdatechecker.h b/indra/viewer_components/updater/llupdatechecker.h index 0f9be14524..09ed306ca7 100755 --- a/indra/viewer_components/updater/llupdatechecker.h +++ b/indra/viewer_components/updater/llupdatechecker.h @@ -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);      }; | 
