From 247eb0c9c3418c10be8f2a0e3c8116758efa702f Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Tue, 7 Jul 2015 19:41:27 +0100 Subject: Backout selfles merge 738255dbbfd679d9e615baab3398e5e345bbb3c5 --- indra/llmessage/CMakeLists.txt | 2 +- indra/llmessage/llavatarnamecache.cpp | 12 +++--- indra/llmessage/llcorehttputil.cpp | 72 +++++++++++++++++------------------ indra/llmessage/llcorehttputil.h | 66 ++++++++++++++++---------------- 4 files changed, 76 insertions(+), 76 deletions(-) (limited to 'indra/llmessage') diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index ba6e9d3939..49f825d8f8 100755 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -256,8 +256,8 @@ if (LL_TESTS) ${LLMESSAGE_LIBRARIES} ${LLCOREHTTP_LIBRARIES} ${JSONCPP_LIBRARIES} - ${BOOST_COROUTINE_LIBRARY} ${BOOST_CONTEXT_LIBRARY} + ${BOOST_COROUTINE_LIBRARY} ${GOOGLEMOCK_LIBRARIES} ) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index d262862c80..7014048021 100755 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -137,8 +137,8 @@ namespace LLAvatarNameCache bool expirationFromCacheControl(const LLSD& headers, F64 *expires); - // This is a coroutine. - void requestAvatarNameCache_(std::string url, std::vector agentIds); + // This is a coroutine. The only parameter that can be specified as a reference is the self + void requestAvatarNameCache_(LLCoros::self& self, std::string url, std::vector agentIds); void handleAvNameCacheSuccess(const LLSD &data, const LLSD &httpResult); } @@ -185,9 +185,9 @@ namespace LLAvatarNameCache // Coroutine for sending and processing avatar name cache requests. // Do not call directly. See documentation in lleventcoro.h and llcoro.h for // further explanation. -void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vector agentIds) +void LLAvatarNameCache::requestAvatarNameCache_(LLCoros::self& self, std::string url, std::vector agentIds) { - LL_DEBUGS("AvNameCache") << "Entering coroutine " << LLCoros::instance().getName() + LL_DEBUGS("AvNameCache") << "Entering coroutine " << LLCoros::instance().getName(self) << " with url '" << url << "', requesting " << agentIds.size() << " Agent Ids" << LL_ENDL; try @@ -195,7 +195,7 @@ void LLAvatarNameCache::requestAvatarNameCache_(std::string url, std::vectorgetReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); //LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL; return results; } -LLSD HttpCoroutineAdapter::getAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump)); - return getAndYield_(request, url, options, headers, httpHandler); + return getAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::getRawAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroRawHandler(replyPump)); - return getAndYield_(request, url, options, headers, httpHandler); + return getAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::getJsonAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::getJsonAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroJSONHandler(replyPump)); - return getAndYield_(request, url, options, headers, httpHandler); + return getAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::getAndYield_(LLCore::HttpRequest::ptr_t &request, +LLSD HttpCoroutineAdapter::getAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) @@ -790,24 +790,24 @@ LLSD HttpCoroutineAdapter::getAndYield_(LLCore::HttpRequest::ptr_t &request, } saveState(hhandle, request, handler); - LLSD results = waitForEventOn(handler->getReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); //LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL; return results; } -LLSD HttpCoroutineAdapter::deleteAndYield(LLCore::HttpRequest::ptr_t request, +LLSD HttpCoroutineAdapter::deleteAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); HttpCoroHandler::ptr_t httpHandler = HttpCoroHandler::ptr_t(new HttpCoroLLSDHandler(replyPump)); - return deleteAndYield_(request, url, options, headers, httpHandler); + return deleteAndYield_(self, request, url, options, headers, httpHandler); } -LLSD HttpCoroutineAdapter::deleteAndYield_(LLCore::HttpRequest::ptr_t &request, +LLSD HttpCoroutineAdapter::deleteAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler) { @@ -825,7 +825,7 @@ LLSD HttpCoroutineAdapter::deleteAndYield_(LLCore::HttpRequest::ptr_t &request, } saveState(hhandle, request, handler); - LLSD results = waitForEventOn(handler->getReplyPump()); + LLSD results = waitForEventOn(self, handler->getReplyPump()); cleanState(); //LL_INFOS() << "Results for transaction " << transactionId << LL_ENDL; return results; @@ -907,7 +907,7 @@ LLCore::HttpStatus HttpCoroutineAdapter::getStatusFromLLSD(const LLSD &httpResul void HttpCoroutineAdapter::callbackHttpGet(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { LLCoros::instance().launch("HttpCoroutineAdapter::genericGetCoro", - boost::bind(&HttpCoroutineAdapter::trivialGetCoro, url, policyId, success, failure)); + boost::bind(&HttpCoroutineAdapter::trivialGetCoro, _1, url, policyId, success, failure)); } /*static*/ @@ -921,7 +921,7 @@ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::str } /*static*/ -void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) +void HttpCoroutineAdapter::trivialGetCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericGetCoro", policyId)); @@ -932,7 +932,7 @@ void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest:: LL_INFOS("HttpCoroutineAdapter", "genericGetCoro") << "Generic GET for " << url << LL_ENDL; - LLSD result = httpAdapter->getAndYield(httpRequest, url, httpOpts); + LLSD result = httpAdapter->getAndYield(self, httpRequest, url, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -957,7 +957,7 @@ void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest:: void HttpCoroutineAdapter::callbackHttpPost(const std::string &url, LLCore::HttpRequest::policy_t policyId, const LLSD &postData, completionCallback_t success, completionCallback_t failure) { LLCoros::instance().launch("HttpCoroutineAdapter::genericPostCoro", - boost::bind(&HttpCoroutineAdapter::trivialPostCoro, url, policyId, postData, success, failure)); + boost::bind(&HttpCoroutineAdapter::trivialPostCoro, _1, url, policyId, postData, success, failure)); } /*static*/ @@ -972,7 +972,7 @@ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &p } /*static*/ -void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure) +void HttpCoroutineAdapter::trivialPostCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", policyId)); @@ -983,7 +983,7 @@ void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest: LL_INFOS("HttpCoroutineAdapter", "genericPostCoro") << "Generic POST for " << url << LL_ENDL; - LLSD result = httpAdapter->postAndYield(httpRequest, url, postData, httpOpts); + LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index cf35177e48..7dd161d1cd 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -320,67 +320,67 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD postAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { - return postAndYield(request, url, body, + return postAndYield(self, request, url, body, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpHeaders::ptr_t &headers) { - return postAndYield(request, url, rawbody, + return postAndYield(self, request, url, rawbody, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postRawAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::BufferArray::ptr_t rawbody, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postRawAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpHeaders::ptr_t &headers) { - return postRawAndYield(request, url, rawbody, + return postRawAndYield(self, request, url, rawbody, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, std::string fileName, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, std::string fileName, LLCore::HttpHeaders::ptr_t &headers) { - return postFileAndYield(request, url, fileName, + return postFileAndYield(self, request, url, fileName, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD postFileAndYield(LLCore::HttpRequest::ptr_t request, + LLSD postFileAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, LLCore::HttpHeaders::ptr_t &headers) { - return postFileAndYield(request, url, assetId, assetType, + return postFileAndYield(self, request, url, assetId, assetType, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } @@ -390,7 +390,7 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD putAndYield(LLCore::HttpRequest::ptr_t request, + LLSD putAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); @@ -400,38 +400,38 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD getAndYield(LLCore::HttpRequest::ptr_t request, + LLSD getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD getAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD getAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { - return getAndYield(request, url, + return getAndYield(self, request, url, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD getRawAndYield(LLCore::HttpRequest::ptr_t request, + LLSD getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD getRawAndYield(LLCore::HttpRequest::ptr_t &request, + LLSD getRawAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { - return getRawAndYield(request, url, + return getRawAndYield(self, request, url, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - LLSD getJsonAndYield(LLCore::HttpRequest::ptr_t request, + LLSD getJsonAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); - LLSD getJsonndYield(LLCore::HttpRequest::ptr_t &request, + LLSD getJsonndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { - return getJsonAndYield(request, url, + return getJsonAndYield(self, request, url, LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } @@ -442,7 +442,7 @@ public: /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - LLSD deleteAndYield(LLCore::HttpRequest::ptr_t request, + LLSD deleteAndYield(LLCoros::self & self, LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); @@ -486,31 +486,31 @@ private: HttpCoroHandler::ptr_t &handler); void cleanState(); - LLSD postAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD postAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD postAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD putAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD putAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD getAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD getAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - LLSD deleteAndYield_(LLCore::HttpRequest::ptr_t &request, + LLSD deleteAndYield_(LLCoros::self & self, LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); - static void trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure); - static void trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure); + static void trivialGetCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure); + static void trivialPostCoro(LLCoros::self& self, std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure); void checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &headers); -- cgit v1.2.3