From 5417ad9fa4593319a16f40574928c27fec2dd3a0 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Thu, 1 Oct 2020 01:28:31 -0400 Subject: [PATCH] Utilize make_shared more heavily in llcore* to reduce all the needless double allocation for the shared ptr atomic ref memory --- indra/llmessage/llcoproceduremanager.cpp | 4 +- indra/llmessage/llcorehttputil.cpp | 46 +++++----- indra/llmessage/llcorehttputil.h | 102 ++++++++++++----------- indra/llmessage/llexperiencecache.cpp | 18 ++-- 4 files changed, 86 insertions(+), 84 deletions(-) diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index bab0baa330d..ea03f827419 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -166,7 +166,7 @@ LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std:: LL_WARNS("CoProcMgr") << "LLCoprocedureManager: No setting for \"" << keyName << "\" setting pool size to default of " << size << LL_ENDL; } - poolPtr_t pool(new LLCoprocedurePool(poolName, size)); + poolPtr_t pool = boost::make_shared<LLCoprocedurePool>(poolName, size); LL_ERRS_IF(!pool, "CoprocedureManager") << "Unable to create pool named \"" << poolName << "\" FATAL!" << LL_ENDL; bool inserted = mPoolMap.emplace(poolName, pool).second; @@ -333,7 +333,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size): for (size_t count = 0; count < mPoolSize; ++count) { - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter( mPoolName + "Adapter", mHTTPPolicy)); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = boost::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>( mPoolName + "Adapter", mHTTPPolicy); std::string pooledCoro = LLCoros::instance().launch( "LLCoprocedurePool("+mPoolName+")::coprocedureInvokerCoro", diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 070d3dd86d5..d6e89bb16c7 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -702,7 +702,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); return postAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -739,7 +739,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); } @@ -749,7 +749,7 @@ LLSD HttpCoroutineAdapter::postRawAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroRawHandler>(replyPump); return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); } @@ -813,7 +813,7 @@ LLSD HttpCoroutineAdapter::postJsonAndSuspend(LLCore::HttpRequest::ptr_t request LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroJSONHandler>(replyPump); LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray); @@ -862,7 +862,7 @@ LLSD HttpCoroutineAdapter::putAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); return putAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -872,7 +872,7 @@ LLSD HttpCoroutineAdapter::putJsonAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroJSONHandler>(replyPump); LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray); @@ -947,7 +947,7 @@ LLSD HttpCoroutineAdapter::getAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -957,7 +957,7 @@ LLSD HttpCoroutineAdapter::getRawAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroRawHandler>(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -966,7 +966,7 @@ LLSD HttpCoroutineAdapter::getJsonAndSuspend(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(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroJSONHandler>(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -1003,7 +1003,7 @@ LLSD HttpCoroutineAdapter::deleteAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); return deleteAndSuspend_(request, url, options, headers, httpHandler); } @@ -1013,7 +1013,7 @@ LLSD HttpCoroutineAdapter::deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t reque LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroJSONHandler>(replyPump); return deleteAndSuspend_(request, url, options, headers, httpHandler); } @@ -1048,7 +1048,7 @@ LLSD HttpCoroutineAdapter::patchAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); return patchAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -1086,10 +1086,10 @@ LLSD HttpCoroutineAdapter::copyAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = boost::make_shared<LLCore::HttpHeaders>(); headers->append(HTTP_OUT_HEADER_DESTINATION, dest); return copyAndSuspend_(request, url, options, headers, httpHandler); @@ -1128,10 +1128,10 @@ LLSD HttpCoroutineAdapter::moveAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = boost::make_shared<HttpCoroLLSDHandler>(replyPump); if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = boost::make_shared<LLCore::HttpHeaders>(); headers->append(HTTP_OUT_HEADER_DESTINATION, dest); return moveAndSuspend_(request, url, options, headers, httpHandler); @@ -1169,7 +1169,7 @@ LLSD HttpCoroutineAdapter::moveAndSuspend_(LLCore::HttpRequest::ptr_t &request, void HttpCoroutineAdapter::checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &headers) { if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = boost::make_shared<LLCore::HttpHeaders>(); if (!headers->find(HTTP_OUT_HEADER_ACCEPT)) { headers->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); @@ -1263,9 +1263,9 @@ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::str void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericGetCoro", policyId)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = boost::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericGetCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); + LLCore::HttpOptions::ptr_t httpOpts = boost::make_shared<LLCore::HttpOptions>(); httpOpts->setWantHeaders(true); @@ -1314,9 +1314,9 @@ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &p void HttpCoroutineAdapter::trivialPostCoro(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)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = boost::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericPostCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); + LLCore::HttpOptions::ptr_t httpOpts = boost::make_shared<LLCore::HttpOptions>(); httpOpts->setWantHeaders(true); diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index 6f0b865f830..d24e8dcde88 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -46,6 +46,8 @@ #include "llassettype.h" #include "lluuid.h" +#include <boost/make_shared.hpp> + /// /// The base llcorehttp library implements many HTTP idioms /// used in the viewer but not all. That library intentionally @@ -340,19 +342,19 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD postAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD postAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD postAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return postAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } LLSD postAndSuspend(LLCore::HttpRequest::ptr_t &request, @@ -360,59 +362,59 @@ class HttpCoroutineAdapter LLCore::HttpHeaders::ptr_t &headers) { return postAndSuspend(request, url, rawbody, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } LLSD postRawAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD postRawAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::BufferArray::ptr_t &rawbody, LLCore::HttpHeaders::ptr_t &headers) { return postRawAndSuspend(request, url, rawbody, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } LLSD postFileAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, std::string fileName, LLCore::HttpHeaders::ptr_t &headers) { - return postFileAndSuspend(request, url, fileName, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + return postFileAndSuspend(request, url, std::move(fileName), + boost::make_shared<LLCore::HttpOptions>(), headers); } LLSD postFileAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD postFileAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLUUID assetId, LLAssetType::EType assetType, LLCore::HttpHeaders::ptr_t &headers) { - return postFileAndSuspend(request, url, assetId, assetType, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + return postFileAndSuspend(request, url, std::move(assetId), assetType, + boost::make_shared<LLCore::HttpOptions>(), headers); } LLSD postJsonAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD postJsonAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return postJsonAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } @@ -424,27 +426,27 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD putAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD putAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t headers) { return putAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } LLSD putJsonAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD putJsonAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return putJsonAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } /// Execute a Get transaction on the supplied URL and yield execution of @@ -455,25 +457,25 @@ class HttpCoroutineAdapter /// LLSD getAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD getAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { return getAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + boost::make_shared<LLCore::HttpOptions>(), headers); } LLSD getRawAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD getRawAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { return getRawAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + boost::make_shared<LLCore::HttpOptions>(), headers); } @@ -483,13 +485,13 @@ class HttpCoroutineAdapter /// before being returned to the caller. LLSD getJsonAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD getJsonAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, LLCore::HttpHeaders::ptr_t &headers) { return getJsonAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + boost::make_shared<LLCore::HttpOptions>(), headers); } @@ -501,13 +503,13 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD deleteAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD deleteAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpHeaders::ptr_t headers) { return deleteAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + boost::make_shared<LLCore::HttpOptions>(), headers); } @@ -517,13 +519,13 @@ class HttpCoroutineAdapter /// before being returned to the caller. LLSD deleteJsonAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpHeaders::ptr_t headers) { return deleteJsonAndSuspend(request, url, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), + boost::make_shared<LLCore::HttpOptions>(), headers); } @@ -535,14 +537,14 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD patchAndSuspend(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())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD patchAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const LLSD & body, LLCore::HttpHeaders::ptr_t &headers) { return patchAndSuspend(request, url, body, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } /// Execute a COPY transaction on the supplied URL and yield execution of @@ -555,14 +557,14 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD copyAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const std::string dest, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD copyAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const std::string & dest, LLCore::HttpHeaders::ptr_t &headers) { return copyAndSuspend(request, url, dest, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } /// Execute a MOVE transaction on the supplied URL and yield execution of @@ -575,14 +577,14 @@ class HttpCoroutineAdapter /// not be deallocated during the yield. LLSD moveAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, const std::string dest, - LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), - LLCore::HttpHeaders::ptr_t headers = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders())); + LLCore::HttpOptions::ptr_t options = boost::make_shared<LLCore::HttpOptions>(), + LLCore::HttpHeaders::ptr_t headers = boost::make_shared<LLCore::HttpHeaders>()); LLSD moveAndSuspend(LLCore::HttpRequest::ptr_t &request, const std::string & url, const std::string & dest, LLCore::HttpHeaders::ptr_t &headers) { return moveAndSuspend(request, url, dest, - LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); + boost::make_shared<LLCore::HttpOptions>(), headers); } /// diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 64c01bd9ebd..76e2e26560c 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -244,7 +244,7 @@ const LLExperienceCache::cache_t& LLExperienceCache::getCached() void LLExperienceCache::requestExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, std::string url, RequestQueue_t requests) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); //LL_INFOS("requestExperiencesCoro") << "url: " << url << LL_ENDL; @@ -522,7 +522,7 @@ void LLExperienceCache::get(const LLUUID& key, LLExperienceCache::ExperienceGetF fetch(key); - signal_ptr signal = signal_ptr(new callback_signal_t()); + signal_ptr signal = boost::make_shared<callback_signal_t>(); std::pair<signal_map_t::iterator, bool> result = mSignalMap.insert(signal_map_t::value_type(key, signal)); if (!result.second) @@ -557,7 +557,7 @@ void LLExperienceCache::fetchAssociatedExperience(const LLUUID& objectId, const void LLExperienceCache::fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID objectId, LLUUID itemId, std::string url, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); if (url.empty()) { @@ -619,7 +619,7 @@ void LLExperienceCache::findExperienceByName(const std::string text, int page, E void LLExperienceCache::findExperienceByNameCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, std::string text, int page, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); std::ostringstream url; @@ -662,7 +662,7 @@ void LLExperienceCache::getGroupExperiences(const LLUUID &groupId, ExperienceGet void LLExperienceCache::getGroupExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID groupId, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); // search for experiences owned by the current group std::string url = mCapability("GroupExperiences"); @@ -705,7 +705,7 @@ void LLExperienceCache::setRegionExperiences(CapabilityQuery_t regioncaps, const void LLExperienceCache::regionExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, CapabilityQuery_t regioncaps, bool update, LLSD experiences, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); // search for experiences owned by the current group std::string url = regioncaps("RegionExperiences"); @@ -817,7 +817,7 @@ void LLExperienceCache::forgetExperiencePermission(const LLUUID &experienceId, E void LLExperienceCache::experiencePermissionCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, permissionInvoker_fn invokerfn, std::string url, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); // search for experiences owned by the current group @@ -848,7 +848,7 @@ void LLExperienceCache::getExperienceAdmin(const LLUUID &experienceId, Experienc void LLExperienceCache::getExperienceAdminCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID experienceId, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); std::string url = mCapability("IsExperienceAdmin"); if (url.empty()) @@ -880,7 +880,7 @@ void LLExperienceCache::updateExperience(LLSD updateData, ExperienceGetFn_t fn) void LLExperienceCache::updateExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLSD updateData, ExperienceGetFn_t fn) { - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + LLCore::HttpRequest::ptr_t httpRequest = boost::make_shared<LLCore::HttpRequest>(); std::string url = mCapability("UpdateExperience"); if (url.empty()) -- GitLab