Allow calling LLNotificationsUtil::add from any thread.

This makes LLStringUtil thread-safe by removing a rather unnecessary
LLFastTimer from LLStringUtil::format.

Same thing for LLTrans::getString and LLTrans::findString, where
even a comment stated that the author wasn't interested in measuring
cpu time at all. In this case I added some code back to make sure
that we're not calling LLTrans::getString() in an inner loop, which
was the reason that the LLFastTimer was added.

Made one string static to avoid 45000 look ups during login, which
kinda triggered the above test.

Finally, LLNotificationsUtil::add is made thread-safe by making
LLNotificationChannelBase::mItems thread-safe and defering a call
to LLNotifications::updateItem to the main thread when called
from another thread (using a little statemachine).
This commit is contained in:
Aleric Inglewood
2013-11-15 17:52:52 +01:00
parent 5f9c6f1b08
commit a8cded0cf6
5 changed files with 167 additions and 24 deletions

View File

@@ -36,9 +36,6 @@
#include <winnls.h> // for WideCharToMultiByte
#endif
LLFastTimer::DeclareTimer FT_STRING_FORMAT("String Format");
std::string ll_safe_string(const char* in)
{
if(in) return std::string(in);
@@ -1190,7 +1187,6 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
template<>
S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions)
{
LLFastTimer ft(FT_STRING_FORMAT);
S32 res = 0;
std::string output;
@@ -1263,7 +1259,6 @@ S32 LLStringUtil::format(std::string& s, const format_map_t& substitutions)
template<>
S32 LLStringUtil::format(std::string& s, const LLSD& substitutions)
{
LLFastTimer ft(FT_STRING_FORMAT);
S32 res = 0;
if (!substitutions.isMap())