summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRider Linden <none@none>2015-03-27 17:00:02 -0700
committerRider Linden <none@none>2015-03-27 17:00:02 -0700
commit735364038767694ea29d9b6a168410e6482cc9c2 (patch)
tree7f04704516d6c5d537bca1fc9290a2beb268c820 /indra/newview
parentb9e80807091aa7a27f1a10a23dd32bbb292d9dfb (diff)
first set of chnages from code review from Nat
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llagent.cpp11
-rwxr-xr-xindra/newview/llagent.h4
-rwxr-xr-xindra/newview/llagentlanguage.cpp2
-rwxr-xr-xindra/newview/llappcorehttp.cpp2
-rwxr-xr-xindra/newview/llappearancemgr.cpp6
-rw-r--r--indra/newview/llavatarrenderinfoaccountant.cpp131
-rw-r--r--indra/newview/llavatarrenderinfoaccountant.h10
-rwxr-xr-xindra/newview/llmaterialmgr.cpp4
8 files changed, 150 insertions, 20 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 81387fb927..667d530e39 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -2559,7 +2559,7 @@ public:
{ }
protected:
- virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content);
+ virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);
virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);
private:
@@ -2572,7 +2572,7 @@ private:
};
//-------------------------------------------------------------------------
-void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content)
+void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)
{
U8 actualMaturity = parseMaturityFromServerResponse(content);
@@ -2774,7 +2774,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity)
<< "' via capability to: " << url << LL_ENDL;
- LLCore::HttpHandle handle = requestPostCapibility("UpdateAgentInformation", url, postData, handler);
+ LLCore::HttpHandle handle = requestPostCapability("UpdateAgentInformation", url, postData, handler);
if (handle == LLCORE_HTTP_HANDLE_INVALID)
{
@@ -2784,7 +2784,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)
}
}
-LLCore::HttpHandle LLAgent::requestPostCapibility(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr)
+LLCore::HttpHandle LLAgent::requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr)
{
LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(url, cap);
LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest,
@@ -2793,6 +2793,9 @@ LLCore::HttpHandle LLAgent::requestPostCapibility(const std::string &cap, const
if (handle == LLCORE_HTTP_HANDLE_INVALID)
{
+ // If no handler was passed in we delete the handler default handler allocated
+ // at the start of this function.
+ // *TODO: Change this metaphore to use boost::shared_ptr<> for handlers. Requires change in LLCore::HTTP
if (!usrhndlr)
delete handler;
LLCore::HttpStatus status = mHttpRequest->getStatus();
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 6b636a2dc0..26120b52f6 100755
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -925,8 +925,8 @@ public:
public:
/// Utilities for allowing the the agent sub managers to post and get via
/// HTTP using the agent's policy settings and headers.
- LLCore::HttpHandle requestPostCapibility(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr = NULL);
- //LLCore::HttpHandle httpGetCapibility(const std::string &cap, const LLURI &uri, LLHttpSDHandler *usrhndlr = NULL);
+ LLCore::HttpHandle requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr = NULL);
+ //LLCore::HttpHandle httpGetCapability(const std::string &cap, const LLURI &uri, LLHttpSDHandler *usrhndlr = NULL);
/** Utility
** **
diff --git a/indra/newview/llagentlanguage.cpp b/indra/newview/llagentlanguage.cpp
index 81fce9b257..f2ac323578 100755
--- a/indra/newview/llagentlanguage.cpp
+++ b/indra/newview/llagentlanguage.cpp
@@ -71,7 +71,7 @@ bool LLAgentLanguage::update()
body["language_is_public"] = gSavedSettings.getBOOL("LanguageIsPublic");
//LLHTTPClient::post(url, body, new LLHTTPClient::Responder);
- LLCore::HttpHandle handle = gAgent.requestPostCapibility("UpdateAgentLanguage", url, body);
+ LLCore::HttpHandle handle = gAgent.requestPostCapability("UpdateAgentLanguage", url, body);
if (handle == LLCORE_HTTP_HANDLE_INVALID)
{
LL_WARNS() << "Unable to change language." << LL_ENDL;
diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp
index cd9166f7b7..51cca273d8 100755
--- a/indra/newview/llappcorehttp.cpp
+++ b/indra/newview/llappcorehttp.cpp
@@ -494,7 +494,7 @@ LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url,
validation_params[CERT_HOSTNAME] = uri.hostName();
- // *TODO*: In the case of an exception while validating the cert, we need a way
+ // *TODO: In the case of an exception while validating the cert, we need a way
// to pass the offending(?) cert back out. *Rider*
try
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index be71c430f4..709d9881e1 100755
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1260,7 +1260,7 @@ public:
virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
protected:
- virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content);
+ virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);
virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);
private:
@@ -1278,7 +1278,7 @@ void LLAppearanceMgrHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::
LLHttpSDHandler::onCompleted(handle, response);
}
-void LLAppearanceMgrHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content)
+void LLAppearanceMgrHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)
{
if (!content.isMap())
{
@@ -3443,7 +3443,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate()
gAgentAvatarp->mLastUpdateRequestCOFVersion = cof_version;
- LLCore::HttpHandle handle = gAgent.requestPostCapibility("UpdateAvatarAppearance", url, postData, handler);
+ LLCore::HttpHandle handle = gAgent.requestPostCapability("UpdateAvatarAppearance", url, postData, handler);
if (handle == LLCORE_HTTP_HANDLE_INVALID)
{
diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp
index 38e153137c..aeaa832bc7 100644
--- a/indra/newview/llavatarrenderinfoaccountant.cpp
+++ b/indra/newview/llavatarrenderinfoaccountant.cpp
@@ -43,7 +43,9 @@
#include "llviewerregion.h"
#include "llvoavatar.h"
#include "llworld.h"
-
+#include "llhttpsdhandler.h"
+#include "httpheaders.h"
+#include "httpoptions.h"
static const std::string KEY_AGENTS = "agents"; // map
static const std::string KEY_WEIGHT = "weight"; // integer
@@ -55,8 +57,113 @@ static const std::string KEY_ERROR = "error";
// Send data updates about once per minute, only need per-frame resolution
LLFrameTimer LLAvatarRenderInfoAccountant::sRenderInfoReportTimer;
+//LLCore::HttpRequest::ptr_t LLAvatarRenderInfoAccountant::sHttpRequest;
+
+#if 0
+//=========================================================================
+class LLAvatarRenderInfoHandler : public LLHttpSDHandler
+{
+public:
+ LLAvatarRenderInfoHandler(const LLURI &uri, U64 regionHandle);
+
+protected:
+ virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content);
+ virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);
+
+private:
+ U64 mRegionHandle;
+};
+
+LLAvatarRenderInfoHandler::LLAvatarRenderInfoHandler(const LLURI &uri, U64 regionHandle) :
+ LLHttpSDHandler(uri),
+ mRegionHandle(regionHandle)
+{
+}
+
+void LLAvatarRenderInfoHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content)
+{
+ LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
+ if (regionp)
+ {
+ if (LLAvatarRenderInfoAccountant::logRenderInfo())
+ {
+ LL_INFOS() << "LRI: Result for avatar weights request for region " << regionp->getName() << ":" << LL_ENDL;
+ }
+
+ if (content.isMap())
+ {
+ if (content.has(KEY_AGENTS))
+ {
+ const LLSD & agents = content[KEY_AGENTS];
+ if (agents.isMap())
+ {
+ LLSD::map_const_iterator report_iter = agents.beginMap();
+ while (report_iter != agents.endMap())
+ {
+ LLUUID target_agent_id = LLUUID(report_iter->first);
+ const LLSD & agent_info_map = report_iter->second;
+ LLViewerObject* avatarp = gObjectList.findObject(target_agent_id);
+ if (avatarp &&
+ avatarp->isAvatar() &&
+ agent_info_map.isMap())
+ { // Extract the data for this avatar
+
+ if (LLAvatarRenderInfoAccountant::logRenderInfo())
+ {
+ LL_INFOS() << "LRI: Agent " << target_agent_id
+ << ": " << agent_info_map << LL_ENDL;
+ }
+
+ if (agent_info_map.has(KEY_WEIGHT))
+ {
+ ((LLVOAvatar *)avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger());
+ }
+ }
+ report_iter++;
+ }
+ }
+ } // has "agents"
+ else if (content.has(KEY_ERROR))
+ {
+ const LLSD & error = content[KEY_ERROR];
+ LL_WARNS() << "Avatar render info GET error: "
+ << error[KEY_IDENTIFIER]
+ << ": " << error[KEY_MESSAGE]
+ << " from region " << regionp->getName()
+ << LL_ENDL;
+ }
+ }
+ }
+ else
+ {
+ LL_INFOS() << "Avatar render weight info received but region not found for "
+ << mRegionHandle << LL_ENDL;
+ }
+}
+void LLAvatarRenderInfoHandler::onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status)
+{
+ LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle);
+ if (regionp)
+ {
+ LL_WARNS() << "HTTP error result for avatar weight GET: " << status.toULong()
+ << ", " << status.toString()
+ << " returned by region " << regionp->getName()
+ << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "Avatar render weight GET error received but region not found for "
+ << mRegionHandle
+ << ", error " << status.toULong()
+ << ", " << status.toString()
+ << LL_ENDL;
+ }
+}
+
+//-------------------------------------------------------------------------
+#else
// HTTP responder class for GET request for avatar render weight information
class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder
{
@@ -142,7 +249,7 @@ public:
}
else
{
- LL_INFOS() << "Avatar render weight info recieved but region not found for "
+ LL_INFOS() << "Avatar render weight info received but region not found for "
<< mRegionHandle << LL_ENDL;
}
}
@@ -150,7 +257,7 @@ public:
private:
U64 mRegionHandle;
};
-
+#endif
// HTTP responder class for POST request for avatar render weight information
class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder
@@ -172,7 +279,7 @@ public:
}
else
{
- LL_WARNS() << "Avatar render weight POST error recieved but region not found for "
+ LL_WARNS() << "Avatar render weight POST error received but region not found for "
<< mRegionHandle
<< ", error " << statusNum
<< ", " << reason
@@ -215,7 +322,6 @@ private:
U64 mRegionHandle;
};
-
// static
// Send request for one region, no timer checks
void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regionp)
@@ -292,7 +398,19 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi
}
// First send a request to get the latest data
+#if 0
+ if (!LLAvatarRenderInfoAccountant::sHttpRequest)
+ sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
+ LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
+
+ LLCore::HttpHeaders::ptr_t httpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false);
+ LLCore::HttpOptions::ptr_t httpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false);
+ LLCore::HttpRequest::policy_t httpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT);
+
+ LLCore::HttpHandle handle = sHttpRequest->
+#else
LLHTTPClient::get(url, new LLAvatarRenderInfoGetResponder(regionp->getHandle()));
+#endif
}
}
@@ -301,6 +419,9 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi
// Called every frame - send render weight requests to every region
void LLAvatarRenderInfoAccountant::idle()
{
+// if (!LLAvatarRenderInfoAccountant::sHttpRequest)
+// sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest());
+
if (sRenderInfoReportTimer.hasExpired())
{
const F32 SECS_BETWEEN_REGION_SCANS = 5.f; // Scan the region list every 5 seconds
diff --git a/indra/newview/llavatarrenderinfoaccountant.h b/indra/newview/llavatarrenderinfoaccountant.h
index d68f2dccfb..13054f5e2f 100644
--- a/indra/newview/llavatarrenderinfoaccountant.h
+++ b/indra/newview/llavatarrenderinfoaccountant.h
@@ -29,6 +29,8 @@
#if ! defined(LL_llavatarrenderinfoaccountant_H)
#define LL_llavatarrenderinfoaccountant_H
+#include "httpcommon.h"
+
class LLViewerRegion;
// Class to gather avatar rendering information
@@ -36,8 +38,6 @@ class LLViewerRegion;
class LLAvatarRenderInfoAccountant
{
public:
- LLAvatarRenderInfoAccountant() {};
- ~LLAvatarRenderInfoAccountant() {};
static void sendRenderInfoToRegion(LLViewerRegion * regionp);
static void getRenderInfoFromRegion(LLViewerRegion * regionp);
@@ -49,8 +49,14 @@ public:
static bool logRenderInfo();
private:
+ LLAvatarRenderInfoAccountant() {};
+ ~LLAvatarRenderInfoAccountant() {};
+
// Send data updates about once per minute, only need per-frame resolution
static LLFrameTimer sRenderInfoReportTimer;
+
+// static LLCore::HttpRequest::ptr_t sHttpRequest;
+
};
#endif /* ! defined(LL_llavatarrenderinfoaccountant_H) */
diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp
index 065d763596..78fbe9af0a 100755
--- a/indra/newview/llmaterialmgr.cpp
+++ b/indra/newview/llmaterialmgr.cpp
@@ -75,7 +75,7 @@ public:
virtual ~LLMaterialHttpHandler();
protected:
- virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content);
+ virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);
virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);
private:
@@ -95,7 +95,7 @@ LLMaterialHttpHandler::~LLMaterialHttpHandler()
{
}
-void LLMaterialHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content)
+void LLMaterialHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)
{
LL_DEBUGS("Materials") << LL_ENDL;
mCallback(true, content);