summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/llsdjson.cpp15
-rw-r--r--indra/newview/llappviewer.cpp4
-rw-r--r--indra/newview/llviewerdisplay.cpp10
3 files changed, 20 insertions, 9 deletions
diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp
index 5d38e55686..1df2a8f9eb 100644
--- a/indra/llcommon/llsdjson.cpp
+++ b/indra/llcommon/llsdjson.cpp
@@ -61,12 +61,20 @@ LLSD LlsdFromJson(const boost::json::value& val)
result = LLSD(val.as_bool());
break;
case boost::json::kind::array:
+ {
result = LLSD::emptyArray();
- for (const auto &element : val.as_array())
+ auto& array = val.as_array();
+ // allocate elements 0 .. (size() - 1) to avoid incremental allocation
+ if (! array.empty())
+ {
+ result[array.size() - 1] = LLSD();
+ }
+ for (const auto &element : array)
{
result.append(LlsdFromJson(element));
}
break;
+ }
case boost::json::kind::object:
result = LLSD::emptyMap();
for (const auto& element : val.as_object())
@@ -106,6 +114,7 @@ boost::json::value LlsdToJson(const LLSD &val)
case LLSD::TypeMap:
{
boost::json::object& obj = result.emplace_object();
+ obj.reserve(val.size());
for (const auto& llsd_dat : llsd::inMap(val))
{
obj[llsd_dat.first] = LlsdToJson(llsd_dat.second);
@@ -115,6 +124,7 @@ boost::json::value LlsdToJson(const LLSD &val)
case LLSD::TypeArray:
{
boost::json::array& json_array = result.emplace_array();
+ json_array.reserve(val.size());
for (const auto& llsd_dat : llsd::inArray(val))
{
json_array.push_back(LlsdToJson(llsd_dat));
@@ -123,7 +133,8 @@ boost::json::value LlsdToJson(const LLSD &val)
}
case LLSD::TypeBinary:
default:
- LL_ERRS("LlsdToJson") << "Unsupported conversion to JSON from LLSD type (" << val.type() << ")." << LL_ENDL;
+ LL_ERRS("LlsdToJson") << "Unsupported conversion to JSON from LLSD type ("
+ << val.type() << ")." << LL_ENDL;
break;
}
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 789aaab70d..77797ad5f0 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3351,10 +3351,10 @@ LLSD LLAppViewer::getViewerInfo() const
LLVector3d pos = gAgent.getPositionGlobal();
info["POSITION"] = ll_sd_from_vector3d(pos);
info["POSITION_LOCAL"] = ll_sd_from_vector3(gAgent.getPosAgentFromGlobal(pos));
- info["REGION"] = gAgent.getRegion()->getName();
+ info["REGION"] = region->getName();
boost::regex regex("\\.(secondlife|lindenlab)\\..*");
- info["HOSTNAME"] = boost::regex_replace(gAgent.getRegion()->getSimHostName(), regex, "");
+ info["HOSTNAME"] = boost::regex_replace(region->getSimHostName(), regex, "");
info["SERVER_VERSION"] = gLastVersionChannel;
LLSLURL slurl;
LLAgentUI::buildSLURL(slurl);
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index aad11d9372..f722d0bd1d 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -58,6 +58,7 @@
#include "llpostprocess.h"
#include "llrender.h"
#include "llscenemonitor.h"
+#include "llsdjson.h"
#include "llselectmgr.h"
#include "llsky.h"
#include "llspatialpartition.h"
@@ -1061,12 +1062,12 @@ void display(bool rebuild, F32 zoom_factor, int subfield, bool for_snapshot)
void getProfileStatsContext(boost::json::object& stats)
{
- auto contextit = stats.emplace("context", boost::json::object_kind).first;
+ // populate the context with info from LLFloaterAbout
+ auto contextit = stats.emplace("context",
+ LlsdToJson(LLAppViewer::instance()->getViewerInfo())).first;
auto& context = contextit->value().as_object();
- auto& versionInfo = LLVersionInfo::instance();
- context.emplace("channel", versionInfo.getChannel());
- context.emplace("version", versionInfo.getVersion());
+ // then add a few more things
unsigned char unique_id[MAC_ADDRESS_BYTES]{};
LLMachineID::getUniqueID(unique_id, sizeof(unique_id));
context.emplace("machine", stringize(LL::hexdump(unique_id, sizeof(unique_id))));
@@ -1074,7 +1075,6 @@ void getProfileStatsContext(boost::json::object& stats)
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
- context.emplace("region", region->getName());
context.emplace("regionid", stringize(region->getRegionID()));
}
LLParcel* parcel = LLViewerParcelMgr::instance().getAgentParcel();