From c2373fb5a6b08b2c32e5f93fa67b25f669e8b47f Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 11 Feb 2010 16:39:15 -0800 Subject: Created stub LLAvatarNameCache for display name lookup, as well as LLAvatarName base data object. Reviewed with Kelly. --- indra/llcommon/CMakeLists.txt | 2 ++ indra/llcommon/llavatarname.cpp | 44 ++++++++++++++++++++++++++++++++++ indra/llcommon/llavatarname.h | 53 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 indra/llcommon/llavatarname.cpp create mode 100644 indra/llcommon/llavatarname.h (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 4481d334b2..bed7b46cd0 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -32,6 +32,7 @@ set(llcommon_SOURCE_FILES llapp.cpp llapr.cpp llassettype.cpp + llavatarname.cpp llbase32.cpp llbase64.cpp llcommon.cpp @@ -113,6 +114,7 @@ set(llcommon_HEADER_FILES llallocator.h llallocator_heap_profile.h llagentconstants.h + llavatarname.h llapp.h llapr.h llassettype.h diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp new file mode 100644 index 0000000000..0563374785 --- /dev/null +++ b/indra/llcommon/llavatarname.cpp @@ -0,0 +1,44 @@ +/** + * @file llavatarname.cpp + * @brief Represents name-related data for an avatar, such as the + * username/SLID ("bobsmith123" or "james.linden") and the display + * name ("James Cook") + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "llavatarname.h" + +bool LLAvatarName::operator<(const LLAvatarName& rhs) const +{ + if (mSLID == rhs.mSLID) + return mDisplayName < rhs.mDisplayName; + else + return mSLID < rhs.mSLID; +} diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h new file mode 100644 index 0000000000..4264a8e655 --- /dev/null +++ b/indra/llcommon/llavatarname.h @@ -0,0 +1,53 @@ +/** + * @file llavatarname.h + * @brief Represents name-related data for an avatar, such as the + * username/SLID ("bobsmith123" or "james.linden") and the display + * name ("James Cook") + * + * $LicenseInfo:firstyear=2010&license=viewergpl$ + * + * Copyright (c) 2010, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ +#ifndef LLAVATARNAME_H +#define LLAVATARNAME_H + +#include + +class LL_COMMON_API LLAvatarName +{ +public: + bool operator<(const LLAvatarName& rhs) const; + + // "bobsmith123" or "james.linden", US-ASCII only + std::string mSLID; + + // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode + // Contains data whether or not user has explicitly set + // a display name; may duplicate their SLID. + std::string mDisplayName; +}; + +#endif -- cgit v1.2.3 From c16591c046fa76fc5d13387efa3bcaec3422e593 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 12 Feb 2010 16:12:12 -0800 Subject: Per-avatar customizable icons next to name links in text Changed LLUrlEntryAgent callbacks to handle both link label and icon Eliminated legacy LLNameCache file loading Reviewed with Kelly --- indra/llcommon/llavatarname.cpp | 7 +++++++ indra/llcommon/llavatarname.h | 11 +++++++++++ 2 files changed, 18 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 0563374785..3b1ab4d267 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -35,6 +35,13 @@ #include "llavatarname.h" +LLAvatarName::LLAvatarName() +: mSLID(), + mDisplayName(), + mLastUpdate(0), + mBadge() +{ } + bool LLAvatarName::operator<(const LLAvatarName& rhs) const { if (mSLID == rhs.mSLID) diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 4264a8e655..7205eb4523 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -39,6 +39,8 @@ class LL_COMMON_API LLAvatarName { public: + LLAvatarName(); + bool operator<(const LLAvatarName& rhs) const; // "bobsmith123" or "james.linden", US-ASCII only @@ -48,6 +50,15 @@ public: // Contains data whether or not user has explicitly set // a display name; may duplicate their SLID. std::string mDisplayName; + + // Names can change, so need to keep track of when name was + // last checked. + // Unix time-from-epoch seconds + U32 mLastUpdate; + + // Can be a viewer UI image name ("Person_Check") or a server-side + // image UUID, or empty string. + std::string mBadge; }; #endif -- cgit v1.2.3 From af8f8b4770eb45b4238d98ddd574ba726470f797 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 19 Feb 2010 11:11:45 -0800 Subject: Improved support for toggling display names on/off Stop pre-populated name cache because we have a web service now for lookup Added mIsLegacy to LLAvatarName so we can colorize those name tags differently --- indra/llcommon/llavatarname.cpp | 1 + indra/llcommon/llavatarname.h | 4 ++++ 2 files changed, 5 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 3b1ab4d267..3950fc3af1 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -38,6 +38,7 @@ LLAvatarName::LLAvatarName() : mSLID(), mDisplayName(), + mIsLegacy(false), mLastUpdate(0), mBadge() { } diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 7205eb4523..fb67c16f45 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -51,6 +51,10 @@ public: // a display name; may duplicate their SLID. std::string mDisplayName; + // If true, both display name and SLID were generated from + // a legacy first and last name, like "James Linden (james.linden)" + bool mIsLegacy; + // Names can change, so need to keep track of when name was // last checked. // Unix time-from-epoch seconds -- cgit v1.2.3 From 596196c6e7a167b6dfaef8f2fbf6c76048314e0d Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 19 Feb 2010 11:18:49 -0800 Subject: Change channel to "Second Life Alpha" so installers don't wipe 1.23 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 540aea4252..d53036844d 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -36,7 +36,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 0; const S32 LL_VERSION_PATCH = 0; -const S32 LL_VERSION_BUILD = 200030; +const S32 LL_VERSION_BUILD = 999999; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From f3e0e9a5264a80d146a1d4d77fd9c4f5d3070278 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 24 Feb 2010 14:31:46 -0800 Subject: Hack to refresh name tags when I change my display name. Also fixes a crash when turning on display names. --- indra/llcommon/llchat.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h index a77bd211f3..71ab80159e 100644 --- a/indra/llcommon/llchat.h +++ b/indra/llcommon/llchat.h @@ -34,7 +34,6 @@ #ifndef LL_LLCHAT_H #define LL_LLCHAT_H -#include "llstring.h" #include "lluuid.h" #include "v3math.h" @@ -75,7 +74,7 @@ typedef enum e_chat_style class LLChat { public: - LLChat(const std::string& text = LLStringUtil::null) + LLChat(const std::string& text = std::string()) : mText(text), mFromName(), mFromID(), -- cgit v1.2.3 From 0b36c4181203e37d6fc3e59817d5b5abd2d7611e Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 8 Apr 2010 15:43:00 -0700 Subject: DEV-47529 Add expiration to display name cache for viewer Also synchronize LLAvatarNameCache with server version TODO: Get expiration time from web service --- indra/llcommon/llavatarname.cpp | 2 +- indra/llcommon/llavatarname.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 3950fc3af1..cad4f941fe 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -39,7 +39,7 @@ LLAvatarName::LLAvatarName() : mSLID(), mDisplayName(), mIsLegacy(false), - mLastUpdate(0), + mExpires(U32_MAX), mBadge() { } diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index fb67c16f45..4d50f6e76d 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -58,7 +58,7 @@ public: // Names can change, so need to keep track of when name was // last checked. // Unix time-from-epoch seconds - U32 mLastUpdate; + U32 mExpires; // Can be a viewer UI image name ("Person_Check") or a server-side // image UUID, or empty string. -- cgit v1.2.3 From 65e565e0e1d7b964048a32a92f59a5dd8f74bb0c Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 12 Apr 2010 16:36:12 -0700 Subject: DEV-47529 Convert viewer to use final People API lookup URL format Reviewed with Simon --- indra/llcommon/llavatarname.cpp | 2 +- indra/llcommon/llavatarname.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index cad4f941fe..48ff7f3cc8 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -38,7 +38,7 @@ LLAvatarName::LLAvatarName() : mSLID(), mDisplayName(), - mIsLegacy(false), + mIsDisplayNameDefault(false), mExpires(U32_MAX), mBadge() { } diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 4d50f6e76d..5a0306c57e 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -53,7 +53,7 @@ public: // If true, both display name and SLID were generated from // a legacy first and last name, like "James Linden (james.linden)" - bool mIsLegacy; + bool mIsDisplayNameDefault; // Names can change, so need to keep track of when name was // last checked. -- cgit v1.2.3 From 69de1f4eb7cdd063bbdd7b4019a6a9799fc5dc5f Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 16 Apr 2010 19:06:17 -0700 Subject: Accept expires timestamp as UTC datetime in LLSD --- indra/llcommon/llavatarname.cpp | 2 +- indra/llcommon/llavatarname.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 48ff7f3cc8..5debf88818 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -39,7 +39,7 @@ LLAvatarName::LLAvatarName() : mSLID(), mDisplayName(), mIsDisplayNameDefault(false), - mExpires(U32_MAX), + mExpires(F64_MAX), mBadge() { } diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 5a0306c57e..72e2980b5c 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -58,7 +58,7 @@ public: // Names can change, so need to keep track of when name was // last checked. // Unix time-from-epoch seconds - U32 mExpires; + F64 mExpires; // Can be a viewer UI image name ("Person_Check") or a server-side // image UUID, or empty string. -- cgit v1.2.3 From 022a598694cd37bebff3322054324c7d27afd5ff Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 20 Apr 2010 17:05:49 -0700 Subject: Viewer caches avatar display names between sessions Reviewed with Simon --- indra/llcommon/llavatarname.cpp | 25 +++++++++++++++++++++++++ indra/llcommon/llavatarname.h | 8 +++++++- 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 5debf88818..62ba7cb112 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -35,6 +35,13 @@ #include "llavatarname.h" +// Store these in pre-built std::strings to avoid memory allocations in +// LLSD map lookups +static const std::string SL_ID("sl_id"); +static const std::string DISPLAY_NAME("display_name"); +static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); +static const std::string EXPIRES("expires"); + LLAvatarName::LLAvatarName() : mSLID(), mDisplayName(), @@ -50,3 +57,21 @@ bool LLAvatarName::operator<(const LLAvatarName& rhs) const else return mSLID < rhs.mSLID; } + +LLSD LLAvatarName::asLLSD() const +{ + LLSD sd; + sd[SL_ID] = mSLID; + sd[DISPLAY_NAME] = mDisplayName; + sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; + sd[EXPIRES] = mExpires; + return sd; +} + +void LLAvatarName::fromLLSD(const LLSD& sd) +{ + mSLID = sd[SL_ID].asString(); + mDisplayName = sd[DISPLAY_NAME].asString(); + mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean(); + mExpires = sd[EXPIRES].asReal(); +} diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 72e2980b5c..11bd5f30b7 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -36,13 +36,19 @@ #include +class LLSD; + class LL_COMMON_API LLAvatarName { public: LLAvatarName(); - + bool operator<(const LLAvatarName& rhs) const; + LLSD asLLSD() const; + + void fromLLSD(const LLSD& sd); + // "bobsmith123" or "james.linden", US-ASCII only std::string mSLID; -- cgit v1.2.3 From 98f5fc5ff006a82cacde47de0cbb564b6e703597 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 22 Apr 2010 14:13:45 -0700 Subject: DEV-47529 Turn off display names if no capability from simulator, and Display name update broadcasts entire new name record to nearby viewers Display name update directly inserts new name into sim cache indra.xml has display_names_enabled setting to control cap Synchronized viewer and server versions of avatar name cache Reviewed with Ambroff --- indra/llcommon/llavatarname.cpp | 10 +++++++--- indra/llcommon/llavatarname.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 62ba7cb112..c35b8380b8 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -35,12 +35,15 @@ #include "llavatarname.h" +#include "lldate.h" +#include "llsd.h" + // Store these in pre-built std::strings to avoid memory allocations in // LLSD map lookups static const std::string SL_ID("sl_id"); static const std::string DISPLAY_NAME("display_name"); static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); -static const std::string EXPIRES("expires"); +static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); LLAvatarName::LLAvatarName() : mSLID(), @@ -64,7 +67,7 @@ LLSD LLAvatarName::asLLSD() const sd[SL_ID] = mSLID; sd[DISPLAY_NAME] = mDisplayName; sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; - sd[EXPIRES] = mExpires; + sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires); return sd; } @@ -73,5 +76,6 @@ void LLAvatarName::fromLLSD(const LLSD& sd) mSLID = sd[SL_ID].asString(); mDisplayName = sd[DISPLAY_NAME].asString(); mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean(); - mExpires = sd[EXPIRES].asReal(); + LLDate expires = sd[DISPLAY_NAME_EXPIRES]; + mExpires = expires.secondsSinceEpoch(); } diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 11bd5f30b7..b30dca6e6e 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -63,7 +63,7 @@ public: // Names can change, so need to keep track of when name was // last checked. - // Unix time-from-epoch seconds + // Unix time-from-epoch seconds for efficiency F64 mExpires; // Can be a viewer UI image name ("Person_Check") or a server-side -- cgit v1.2.3 From e4f2887983dc6f473c6657b8b653437557c638fa Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 26 Apr 2010 14:19:58 -0700 Subject: Don't save dummy records (from 503 errors) to disk cache --- indra/llcommon/llavatarname.cpp | 1 + indra/llcommon/llavatarname.h | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index c35b8380b8..4272e096ed 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -49,6 +49,7 @@ LLAvatarName::LLAvatarName() : mSLID(), mDisplayName(), mIsDisplayNameDefault(false), + mIsDummy(false), mExpires(F64_MAX), mBadge() { } diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index b30dca6e6e..3e26887d7a 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -61,6 +61,11 @@ public: // a legacy first and last name, like "James Linden (james.linden)" bool mIsDisplayNameDefault; + // Under error conditions, we may insert "dummy" records with + // names like "???" into caches as placeholders. These can be + // shown in UI, but are not serialized. + bool mIsDummy; + // Names can change, so need to keep track of when name was // last checked. // Unix time-from-epoch seconds for efficiency -- cgit v1.2.3 From 8fae11ee368e5b1dce858cdd698714384430858b Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 28 Apr 2010 17:02:50 -0700 Subject: Remove prototype support for badges next to avatar names Easy to reimplement if we decide we want to do it. --- indra/llcommon/llavatarname.cpp | 3 +-- indra/llcommon/llavatarname.h | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 4272e096ed..4eeb6e706d 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -50,8 +50,7 @@ LLAvatarName::LLAvatarName() mDisplayName(), mIsDisplayNameDefault(false), mIsDummy(false), - mExpires(F64_MAX), - mBadge() + mExpires(F64_MAX) { } bool LLAvatarName::operator<(const LLAvatarName& rhs) const diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 3e26887d7a..d7d91e1c7a 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -70,10 +70,6 @@ public: // last checked. // Unix time-from-epoch seconds for efficiency F64 mExpires; - - // Can be a viewer UI image name ("Person_Check") or a server-side - // image UUID, or empty string. - std::string mBadge; }; #endif -- cgit v1.2.3 From 6b00537c871fb08f760016698c7e83f178c1cf55 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 12 May 2010 16:30:57 -0700 Subject: DEV-50013 WIP Added utility to get name and SLID in single string --- indra/llcommon/llavatarname.cpp | 15 +++++++++++++++ indra/llcommon/llavatarname.h | 4 ++++ 2 files changed, 19 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 4eeb6e706d..7415acadd4 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -79,3 +79,18 @@ void LLAvatarName::fromLLSD(const LLSD& sd) LLDate expires = sd[DISPLAY_NAME_EXPIRES]; mExpires = expires.secondsSinceEpoch(); } + +std::string LLAvatarName::getNameAndSLID() const +{ + std::string name; + if (!mSLID.empty()) + { + name = mDisplayName + " (" + mSLID + ")"; + } + else + { + // ...display names are off, legacy name is in mDisplayName + name = mDisplayName; + } + return name; +} diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index d7d91e1c7a..87750210c6 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -49,6 +49,10 @@ public: void fromLLSD(const LLSD& sd); + // For normal names, returns "James Linden (james.linden)" + // When display names are disabled returns just "James Linden" + std::string getNameAndSLID() const; + // "bobsmith123" or "james.linden", US-ASCII only std::string mSLID; -- cgit v1.2.3 From f4148502e484d516b42c4a88603eee6889d45697 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 18 May 2010 16:00:45 -0700 Subject: Rename mSLID to mUsername to match the name of the field in the UI Product made a late-breaking request to change the name of this field. The wire protocol for People API has not yet changed. --- indra/llcommon/llavatarname.cpp | 16 +++++++++------- indra/llcommon/llavatarname.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 7415acadd4..de51a7f2aa 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -46,7 +46,7 @@ static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); LLAvatarName::LLAvatarName() -: mSLID(), +: mUsername(), mDisplayName(), mIsDisplayNameDefault(false), mIsDummy(false), @@ -55,16 +55,18 @@ LLAvatarName::LLAvatarName() bool LLAvatarName::operator<(const LLAvatarName& rhs) const { - if (mSLID == rhs.mSLID) + if (mUsername == rhs.mUsername) return mDisplayName < rhs.mDisplayName; else - return mSLID < rhs.mSLID; + return mUsername < rhs.mUsername; } LLSD LLAvatarName::asLLSD() const { LLSD sd; - sd[SL_ID] = mSLID; + // Due to a late-breaking change request from Product, we renamed + // "SLID" to "Username", but it was too late to change the wire format. + sd[SL_ID] = mUsername; sd[DISPLAY_NAME] = mDisplayName; sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires); @@ -73,7 +75,7 @@ LLSD LLAvatarName::asLLSD() const void LLAvatarName::fromLLSD(const LLSD& sd) { - mSLID = sd[SL_ID].asString(); + mUsername = sd[SL_ID].asString(); // see asLLSD() above mDisplayName = sd[DISPLAY_NAME].asString(); mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean(); LLDate expires = sd[DISPLAY_NAME_EXPIRES]; @@ -83,9 +85,9 @@ void LLAvatarName::fromLLSD(const LLSD& sd) std::string LLAvatarName::getNameAndSLID() const { std::string name; - if (!mSLID.empty()) + if (!mUsername.empty()) { - name = mDisplayName + " (" + mSLID + ")"; + name = mDisplayName + " (" + mUsername + ")"; } else { diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 87750210c6..39071ec4c7 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -54,7 +54,7 @@ public: std::string getNameAndSLID() const; // "bobsmith123" or "james.linden", US-ASCII only - std::string mSLID; + std::string mUsername; // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode // Contains data whether or not user has explicitly set -- cgit v1.2.3 From 31220ceffbacdf0f14929b735b0c9e250e1225ca Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 11:23:29 -0700 Subject: DEV-50013 Viewer reads legacy first/last name from People API Useful for voice subsystem and muting subsystem. --- indra/llcommon/llavatarname.cpp | 18 ++++++++++++++++++ indra/llcommon/llavatarname.h | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index de51a7f2aa..e30f353a6c 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -42,12 +42,16 @@ // LLSD map lookups static const std::string SL_ID("sl_id"); static const std::string DISPLAY_NAME("display_name"); +static const std::string LEGACY_FIRST_NAME("legacy_first_name"); +static const std::string LEGACY_LAST_NAME("legacy_last_name"); static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); LLAvatarName::LLAvatarName() : mUsername(), mDisplayName(), + mLegacyFirstName(), + mLegacyLastName(), mIsDisplayNameDefault(false), mIsDummy(false), mExpires(F64_MAX) @@ -68,6 +72,8 @@ LLSD LLAvatarName::asLLSD() const // "SLID" to "Username", but it was too late to change the wire format. sd[SL_ID] = mUsername; sd[DISPLAY_NAME] = mDisplayName; + sd[LEGACY_FIRST_NAME] = mLegacyFirstName; + sd[LEGACY_LAST_NAME] = mLegacyLastName; sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires); return sd; @@ -77,6 +83,8 @@ void LLAvatarName::fromLLSD(const LLSD& sd) { mUsername = sd[SL_ID].asString(); // see asLLSD() above mDisplayName = sd[DISPLAY_NAME].asString(); + mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString(); + mLegacyLastName = sd[LEGACY_LAST_NAME].asString(); mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean(); LLDate expires = sd[DISPLAY_NAME_EXPIRES]; mExpires = expires.secondsSinceEpoch(); @@ -96,3 +104,13 @@ std::string LLAvatarName::getNameAndSLID() const } return name; } + +std::string LLAvatarName::getLegacyName() const +{ + std::string name; + name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() ); + name = mLegacyFirstName; + name += " "; + name += mLegacyLastName; + return name; +} diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 39071ec4c7..fb5cb277a2 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -53,14 +53,31 @@ public: // When display names are disabled returns just "James Linden" std::string getNameAndSLID() const; + // Returns "James Linden" or "bobsmith123 Resident" for backwards + // compatibility with systems like voice and muting + // *TODO: Eliminate this in favor of username only + std::string getLegacyName() const; + // "bobsmith123" or "james.linden", US-ASCII only std::string mUsername; // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode // Contains data whether or not user has explicitly set - // a display name; may duplicate their SLID. + // a display name; may duplicate their username. std::string mDisplayName; + // For "James Linden", "James" + // For "bobsmith123", "bobsmith123" + // Used to communicate with legacy systems like voice and muting which + // rely on old-style names. + // *TODO: Eliminate this in favor of username only + std::string mLegacyFirstName; + + // For "James Linden", "Linden" + // For "bobsmith123", "Resident" + // see above for rationale + std::string mLegacyLastName; + // If true, both display name and SLID were generated from // a legacy first and last name, like "James Linden (james.linden)" bool mIsDisplayNameDefault; -- cgit v1.2.3 From aee08f53f7a71bb7373345cae19c988ff985aa03 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 19 May 2010 14:35:29 -0700 Subject: Temporarily accept both username and sl_id from People API Need this for testing during transition, soon we can remove the code to read "sl_id" --- indra/llcommon/llavatarname.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index e30f353a6c..5a20aff4e6 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -41,6 +41,7 @@ // Store these in pre-built std::strings to avoid memory allocations in // LLSD map lookups static const std::string SL_ID("sl_id"); +static const std::string USERNAME("username"); static const std::string DISPLAY_NAME("display_name"); static const std::string LEGACY_FIRST_NAME("legacy_first_name"); static const std::string LEGACY_LAST_NAME("legacy_last_name"); @@ -68,9 +69,7 @@ bool LLAvatarName::operator<(const LLAvatarName& rhs) const LLSD LLAvatarName::asLLSD() const { LLSD sd; - // Due to a late-breaking change request from Product, we renamed - // "SLID" to "Username", but it was too late to change the wire format. - sd[SL_ID] = mUsername; + sd[USERNAME] = mUsername; sd[DISPLAY_NAME] = mDisplayName; sd[LEGACY_FIRST_NAME] = mLegacyFirstName; sd[LEGACY_LAST_NAME] = mLegacyLastName; @@ -81,7 +80,17 @@ LLSD LLAvatarName::asLLSD() const void LLAvatarName::fromLLSD(const LLSD& sd) { - mUsername = sd[SL_ID].asString(); // see asLLSD() above + // *HACK: accept both wire formats for now, as we are transitioning + // People API to use "username" + if (sd.has(USERNAME)) + { + mUsername = sd[USERNAME].asString(); + } + else + { + // *TODO: Remove + mUsername = sd[SL_ID].asString(); + } mDisplayName = sd[DISPLAY_NAME].asString(); mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString(); mLegacyLastName = sd[LEGACY_LAST_NAME].asString(); -- cgit v1.2.3 From d674d11f895b8f3d578cded931cdc1c430379c95 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 21 May 2010 17:11:31 -0700 Subject: Rename LLAvatarName::getNameAndSLID() to getCompleteName() Discussed with Leyla/Richard --- indra/llcommon/llavatarname.cpp | 2 +- indra/llcommon/llavatarname.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 5a20aff4e6..13b6ad705b 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -99,7 +99,7 @@ void LLAvatarName::fromLLSD(const LLSD& sd) mExpires = expires.secondsSinceEpoch(); } -std::string LLAvatarName::getNameAndSLID() const +std::string LLAvatarName::getCompleteName() const { std::string name; if (!mUsername.empty()) diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index fb5cb277a2..8b74e006c3 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -51,7 +51,7 @@ public: // For normal names, returns "James Linden (james.linden)" // When display names are disabled returns just "James Linden" - std::string getNameAndSLID() const; + std::string getCompleteName() const; // Returns "James Linden" or "bobsmith123 Resident" for backwards // compatibility with systems like voice and muting -- cgit v1.2.3 From a41d414625b07c3aff9bdd7be487c5b908d6a49f Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 26 May 2010 16:45:54 -0700 Subject: DEV-50013 Viewer only reads "username" from People API never "sl_id" --- indra/llcommon/llavatarname.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 13b6ad705b..6e0582f865 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -40,7 +40,6 @@ // Store these in pre-built std::strings to avoid memory allocations in // LLSD map lookups -static const std::string SL_ID("sl_id"); static const std::string USERNAME("username"); static const std::string DISPLAY_NAME("display_name"); static const std::string LEGACY_FIRST_NAME("legacy_first_name"); @@ -80,17 +79,7 @@ LLSD LLAvatarName::asLLSD() const void LLAvatarName::fromLLSD(const LLSD& sd) { - // *HACK: accept both wire formats for now, as we are transitioning - // People API to use "username" - if (sd.has(USERNAME)) - { - mUsername = sd[USERNAME].asString(); - } - else - { - // *TODO: Remove - mUsername = sd[SL_ID].asString(); - } + mUsername = sd[USERNAME].asString(); mDisplayName = sd[DISPLAY_NAME].asString(); mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString(); mLegacyLastName = sd[LEGACY_LAST_NAME].asString(); -- cgit v1.2.3 From c7a6a2e08f34b2cd21816a905c21e8017646001c Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 27 May 2010 14:56:29 -0700 Subject: DEV-50013 Friendlier info if you can't change name due to time lockout Reviewed with Leyla --- indra/llcommon/llavatarname.cpp | 7 ++++++- indra/llcommon/llavatarname.h | 5 +++++ indra/llcommon/llstring.cpp | 11 +++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 6e0582f865..14dc41591b 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -46,6 +46,7 @@ static const std::string LEGACY_FIRST_NAME("legacy_first_name"); static const std::string LEGACY_LAST_NAME("legacy_last_name"); static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); +static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); LLAvatarName::LLAvatarName() : mUsername(), @@ -54,7 +55,8 @@ LLAvatarName::LLAvatarName() mLegacyLastName(), mIsDisplayNameDefault(false), mIsDummy(false), - mExpires(F64_MAX) + mExpires(F64_MAX), + mNextUpdate(0.0) { } bool LLAvatarName::operator<(const LLAvatarName& rhs) const @@ -74,6 +76,7 @@ LLSD LLAvatarName::asLLSD() const sd[LEGACY_LAST_NAME] = mLegacyLastName; sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires); + sd[DISPLAY_NAME_NEXT_UPDATE] = LLDate(mNextUpdate); return sd; } @@ -86,6 +89,8 @@ void LLAvatarName::fromLLSD(const LLSD& sd) mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean(); LLDate expires = sd[DISPLAY_NAME_EXPIRES]; mExpires = expires.secondsSinceEpoch(); + LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE]; + mNextUpdate = next_update.secondsSinceEpoch(); } std::string LLAvatarName::getCompleteName() const diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 8b74e006c3..650a09a125 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -91,6 +91,11 @@ public: // last checked. // Unix time-from-epoch seconds for efficiency F64 mExpires; + + // You can only change your name every N hours, so record + // when the next update is allowed + // Unix time-from-epoch seconds + F64 mNextUpdate; }; #endif diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index b5a73ec1d1..637064d75f 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -694,14 +694,17 @@ void LLStringOps::setupDatetimeInfo (bool daylight) nowT = time (NULL); - tmpT = localtime (&nowT); - localT = mktime (tmpT); - tmpT = gmtime (&nowT); gmtT = mktime (tmpT); + tmpT = localtime (&nowT); + localT = mktime (tmpT); + sLocalTimeOffset = (long) (gmtT - localT); - + if (tmpT->tm_isdst) + { + sLocalTimeOffset -= 60 * 60; // 1 hour + } sPacificDaylightTime = daylight; sPacificTimeOffset = (sPacificDaylightTime? 7 : 8 ) * 60 * 60; -- cgit v1.2.3 From 88e7a631b3e4c3d63aa80fe9b3e7f2595d3f45f8 Mon Sep 17 00:00:00 2001 From: "Boroondas Gupte (daggyfied changeset by Techwolf Lupindo, original fix by Robin Cornelius)" Date: Thu, 16 Sep 2010 13:26:45 +0200 Subject: SNOW-512/SNOW-287: Build of LLPlugin fails on 64bit linux due to non PIC code linking into the DSO Formatting, cleanup, and one minor change by Techwolf Lupindo. Minor change was a move of the hunk in indra/media_plugins/webkit/CmakeLists.txt to same area as the other plugins CmakeLists.txt files. daggyfied version of https://bitbucket.org/Techwolf/viewer-development/changeset/00bd21962052 --- indra/llcommon/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 9ead183a9e..feb6d50799 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -250,6 +250,13 @@ list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) if(LLCOMMON_LINK_SHARED) add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) + if(NOT CMAKE_SIZEOF_VOID_P MATCHES 4) + if(WINDOWS) + add_definitions(/FIXED:NO) + else(WINDOWS) # not windows therefore gcc LINUX and DARWIN + add_definitions(-fPIC) + endif(WINDOWS) + endif(NOT CMAKE_SIZEOF_VOID_P MATCHES 4) ll_stage_sharedlib(llcommon) else(LLCOMMON_LINK_SHARED) add_library (llcommon ${llcommon_SOURCE_FILES}) -- cgit v1.2.3 From 64f0b9a7f8d96e170049990372f445d471b826ac Mon Sep 17 00:00:00 2001 From: "Boroondas Gupte (original patches by Aimee Linden)" Date: Tue, 31 Aug 2010 13:48:30 +0200 Subject: SNOW-748 FIXED Building on OSX 10.6 fails with "warning: -mdynamic-no-pic overrides - fpic or -fPIC" Originally commited at http://svn.secondlife.com/trac/linden/changeset/3499/projects/2010/snowglobe and http://svn.secondlife.com/trac/linden/changeset/3501 SVN changeset 3499 partially applied with --ignore-whitespace: Hunk #1 FAILED at 259. Hunk #2 FAILED at 265. 2 out of 2 hunks FAILED -- saving rejects to file indra/llcommon/CMakeLists.txt.rej patching file indra/media_plugins/webkit/CMakeLists.txt Hunk #1 succeeded at 33 with fuzz 1 (offset -8 lines). patching file indra/media_plugins/base/CMakeLists.txt patching file indra/media_plugins/gstreamer010/CMakeLists.txt patching file indra/media_plugins/example/CMakeLists.txt patching file indra/llplugin/CMakeLists.txt Manually applied to indra/llcommon/CMakeLists.txt (straight forward). SVN changeset 3501 applied with fuzz 1: patching file indra/media_plugins/webkit/CMakeLists.txt Hunk #1 succeeded at 33 with fuzz 1 (offset -8 lines). Hunk #2 succeeded at 39 with fuzz 1 (offset -8 lines). No further changes other than that. --- indra/llcommon/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index feb6d50799..20a6c8d709 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -250,13 +250,13 @@ list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) if(LLCOMMON_LINK_SHARED) add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) - if(NOT CMAKE_SIZEOF_VOID_P MATCHES 4) + if(NOT WORD_SIZE EQUAL 32) if(WINDOWS) add_definitions(/FIXED:NO) else(WINDOWS) # not windows therefore gcc LINUX and DARWIN add_definitions(-fPIC) endif(WINDOWS) - endif(NOT CMAKE_SIZEOF_VOID_P MATCHES 4) + endif(NOT WORD_SIZE EQUAL 32) ll_stage_sharedlib(llcommon) else(LLCOMMON_LINK_SHARED) add_library (llcommon ${llcommon_SOURCE_FILES}) -- cgit v1.2.3 From ea112188e258cd51856b767311ee7917c114413a Mon Sep 17 00:00:00 2001 From: Boroondas Gupte Date: Tue, 31 Aug 2010 14:33:27 +0200 Subject: SNOW-748 FOLLOWUP make CMake if indentation consistent with other occurrences (i.e. two spaces only) --- indra/llcommon/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 20a6c8d709..f5acadf30c 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -249,15 +249,15 @@ set_source_files_properties(${llcommon_HEADER_FILES} list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES}) if(LLCOMMON_LINK_SHARED) - add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) - if(NOT WORD_SIZE EQUAL 32) - if(WINDOWS) - add_definitions(/FIXED:NO) - else(WINDOWS) # not windows therefore gcc LINUX and DARWIN - add_definitions(-fPIC) - endif(WINDOWS) - endif(NOT WORD_SIZE EQUAL 32) - ll_stage_sharedlib(llcommon) + add_library (llcommon SHARED ${llcommon_SOURCE_FILES}) + if(NOT WORD_SIZE EQUAL 32) + if(WINDOWS) + add_definitions(/FIXED:NO) + else(WINDOWS) # not windows therefore gcc LINUX and DARWIN + add_definitions(-fPIC) + endif(WINDOWS) + endif(NOT WORD_SIZE EQUAL 32) + ll_stage_sharedlib(llcommon) else(LLCOMMON_LINK_SHARED) add_library (llcommon ${llcommon_SOURCE_FILES}) endif(LLCOMMON_LINK_SHARED) -- cgit v1.2.3 From e45b3c6884bc7d9bc457b9633932c8aad5a28430 Mon Sep 17 00:00:00 2001 From: Aimee Linden Date: Sat, 4 Sep 2010 19:35:27 +0100 Subject: Correct license on newly exported files to LGPL. --- indra/llcommon/llavatarname.cpp | 36 +++++++++++++++--------------------- indra/llcommon/llavatarname.h | 36 +++++++++++++++--------------------- 2 files changed, 30 insertions(+), 42 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp index 14dc41591b..b1ec9e9875 100644 --- a/indra/llcommon/llavatarname.cpp +++ b/indra/llcommon/llavatarname.cpp @@ -4,31 +4,25 @@ * username/SLID ("bobsmith123" or "james.linden") and the display * name ("James Cook") * - * $LicenseInfo:firstyear=2010&license=viewergpl$ - * - * Copyright (c) 2010, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "linden_common.h" diff --git a/indra/llcommon/llavatarname.h b/indra/llcommon/llavatarname.h index 650a09a125..145aeccd35 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llcommon/llavatarname.h @@ -4,31 +4,25 @@ * username/SLID ("bobsmith123" or "james.linden") and the display * name ("James Cook") * - * $LicenseInfo:firstyear=2010&license=viewergpl$ - * - * Copyright (c) 2010, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LLAVATARNAME_H -- cgit v1.2.3 From 39e5d2ecf04deceda92d6a53413298ca1c3bc0c7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 8 Sep 2010 23:03:56 -0700 Subject: VWR-22761 : Rearchitecture of llmetricperformancetester and simple (non complete) implementation in llimagej2c --- indra/llcommon/CMakeLists.txt | 2 + indra/llcommon/llmetricperformancetester.cpp | 245 +++++++++++++++++++++++++++ indra/llcommon/llmetricperformancetester.h | 197 +++++++++++++++++++++ 3 files changed, 444 insertions(+) create mode 100644 indra/llcommon/llmetricperformancetester.cpp create mode 100644 indra/llcommon/llmetricperformancetester.h (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 2a036df06e..000648206f 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -54,6 +54,7 @@ set(llcommon_SOURCE_FILES llevents.cpp lleventtimer.cpp llfasttimer_class.cpp + llmetricperformancetester.cpp llfile.cpp llfindlocale.cpp llfixedbuffer.cpp @@ -157,6 +158,7 @@ set(llcommon_HEADER_FILES lleventemitter.h llextendedstatus.h llfasttimer.h + llmetricperformancetester.h llfile.h llfindlocale.h llfixedbuffer.h diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp new file mode 100644 index 0000000000..bd548f199a --- /dev/null +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -0,0 +1,245 @@ +/** + * @file llmetricperformancetester.cpp + * @brief LLMetricPerformanceTesterBasic and LLMetricPerformanceTesterWithSession classes implementation + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "indra_constants.h" +#include "llerror.h" +#include "llsdserialize.h" +#include "llstat.h" +#include "lltreeiterators.h" +#include "llmetricperformancetester.h" + +//---------------------------------------------------------------------------------------------- +// LLMetricPerformanceTesterBasic : static methods and testers management +//---------------------------------------------------------------------------------------------- + +LLMetricPerformanceTesterBasic::name_tester_map_t LLMetricPerformanceTesterBasic::sTesterMap ; + +/*static*/ +void LLMetricPerformanceTesterBasic::cleanClass() +{ + for (name_tester_map_t::iterator iter = sTesterMap.begin() ; iter != sTesterMap.end() ; ++iter) + { + delete iter->second ; + } + sTesterMap.clear() ; +} + +/*static*/ +BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) +{ + llassert_always(tester != NULL); + std::string name = tester->getTesterName() ; + if (getTester(name)) + { + llerrs << "Tester name is already used by some other tester : " << name << llendl ; + return FALSE; + } + + sTesterMap.insert(std::make_pair(name, tester)); + return TRUE; +} + +/*static*/ +LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name) +{ + name_tester_map_t::iterator found_it = sTesterMap.find(name) ; + if (found_it != sTesterMap.end()) + { + return found_it->second ; + } + return NULL ; +} + +//---------------------------------------------------------------------------------------------- +// LLMetricPerformanceTesterBasic : Tester instance methods +//---------------------------------------------------------------------------------------------- + +LLMetricPerformanceTesterBasic::LLMetricPerformanceTesterBasic(std::string name) : + mName(name), + mCount(0) +{ + if (mName == std::string()) + { + llerrs << "LLMetricPerformanceTesterBasic construction invalid : Empty name passed to constructor" << llendl ; + } + + mValidInstance = LLMetricPerformanceTesterBasic::addTester(this) ; +} + +LLMetricPerformanceTesterBasic::~LLMetricPerformanceTesterBasic() +{ +} + +void LLMetricPerformanceTesterBasic::preOutputTestResults(LLSD* sd) +{ + incrementCurrentCount() ; + (*sd)[getCurrentLabelName()]["Name"] = mName ; +} + +void LLMetricPerformanceTesterBasic::postOutputTestResults(LLSD* sd) +{ + LLMutexLock lock(LLFastTimer::sLogLock); + LLFastTimer::sLogQueue.push((*sd)); +} + +void LLMetricPerformanceTesterBasic::outputTestResults() +{ + LLSD sd; + + preOutputTestResults(&sd) ; + outputTestRecord(&sd) ; + postOutputTestResults(&sd) ; +} + +void LLMetricPerformanceTesterBasic::addMetric(std::string str) +{ + mMetricStrings.push_back(str) ; +} + +/*virtual*/ +void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) +{ + resetCurrentCount() ; + + std::string currentLabel = getCurrentLabelName(); + BOOL in_base = (*base).has(currentLabel) ; + BOOL in_current = (*current).has(currentLabel) ; + + while(in_base || in_current) + { + LLSD::String label = currentLabel ; + + if(in_base && in_current) + { + *os << llformat("%s\n", label.c_str()) ; + + for(U32 index = 0 ; index < mMetricStrings.size() ; index++) + { + switch((*current)[label][ mMetricStrings[index] ].type()) + { + case LLSD::TypeInteger: + compareTestResults(os, mMetricStrings[index], + (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; + break ; + case LLSD::TypeReal: + compareTestResults(os, mMetricStrings[index], + (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; + break; + default: + llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; + } + } + } + + incrementCurrentCount(); + currentLabel = getCurrentLabelName(); + in_base = (*base).has(currentLabel) ; + in_current = (*current).has(currentLabel) ; + } +} + +/*virtual*/ +void LLMetricPerformanceTesterBasic::compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) +{ + *os << llformat(" ,%s, %d, %d, %d, %.4f\n", metric_string.c_str(), v_base, v_current, + v_current - v_base, (v_base != 0) ? 100.f * v_current / v_base : 0) ; +} + +/*virtual*/ +void LLMetricPerformanceTesterBasic::compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) +{ + *os << llformat(" ,%s, %.4f, %.4f, %.4f, %.4f\n", metric_string.c_str(), v_base, v_current, + v_current - v_base, (fabs(v_base) > 0.0001f) ? 100.f * v_current / v_base : 0.f ) ; +} + +//---------------------------------------------------------------------------------------------- +// LLMetricPerformanceTesterWithSession +//---------------------------------------------------------------------------------------------- + +LLMetricPerformanceTesterWithSession::LLMetricPerformanceTesterWithSession(std::string name) : + LLMetricPerformanceTesterBasic(name), + mBaseSessionp(NULL), + mCurrentSessionp(NULL) +{ +} + +LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() +{ + if (mBaseSessionp) + { + delete mBaseSessionp ; + mBaseSessionp = NULL ; + } + if (mCurrentSessionp) + { + delete mCurrentSessionp ; + mCurrentSessionp = NULL ; + } +} + +/*virtual*/ +void LLMetricPerformanceTesterWithSession::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) +{ + // Load the base session + resetCurrentCount() ; + mBaseSessionp = loadTestSession(base) ; + + // Load the current session + resetCurrentCount() ; + mCurrentSessionp = loadTestSession(current) ; + + if (!mBaseSessionp || !mCurrentSessionp) + { + llerrs << "Error loading test sessions." << llendl ; + } + + // Compare + compareTestSessions(os) ; + + // Release memory + if (mBaseSessionp) + { + delete mBaseSessionp ; + mBaseSessionp = NULL ; + } + if (mCurrentSessionp) + { + delete mCurrentSessionp ; + mCurrentSessionp = NULL ; + } +} + + +//---------------------------------------------------------------------------------------------- +// LLTestSession +//---------------------------------------------------------------------------------------------- + +LLMetricPerformanceTesterWithSession::LLTestSession::~LLTestSession() +{ +} + diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h new file mode 100644 index 0000000000..82d579b188 --- /dev/null +++ b/indra/llcommon/llmetricperformancetester.h @@ -0,0 +1,197 @@ +/** + * @file llmetricperformancetester.h + * @brief LLMetricPerformanceTesterBasic and LLMetricPerformanceTesterWithSession classes definition + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_METRICPERFORMANCETESTER_H +#define LL_METRICPERFORMANCETESTER_H + +/** + * @class LLMetricPerformanceTesterBasic + * @brief Performance Metric Base Class + */ +class LL_COMMON_API LLMetricPerformanceTesterBasic +{ +public: + /** + * @brief Creates a basic tester instance. + * @param[in] name - Unique string identifying this tester instance. + */ + LLMetricPerformanceTesterBasic(std::string name); + virtual ~LLMetricPerformanceTesterBasic(); + + /** + * @return Returns true if the instance has been added to the tester map. + * Need to be tested after creation of a tester instance so to know if the tester is correctly handled. + * A tester might not be added to the map if another tester with the same name already exists. + */ + BOOL isValid() const { return mValidInstance; } + + /** + * @brief Write a set of test results to the log LLSD. + */ + void outputTestResults() ; + + /** + * @brief Compare the test results. + * By default, compares the test results against the baseline one by one, item by item, + * in the increasing order of the LLSD record counter, starting from the first one. + */ + virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; + + /** + * @return Returns the number of the test metrics in this tester instance. + */ + S32 getNumberOfMetrics() const { return mMetricStrings.size() ;} + /** + * @return Returns the metric name at index + * @param[in] index - Index on the list of metrics managed by this tester instance. + */ + std::string getMetricName(S32 index) const { return mMetricStrings[index] ;} + +protected: + /** + * @return Returns the name of this tester instance. + */ + std::string getTesterName() const { return mName ;} + + /** + * @brief Insert a new metric to be managed by this tester instance. + * @param[in] str - Unique string identifying the new metric. + */ + void addMetric(std::string str) ; + + /** + * @brief Compare test results, provided in 2 flavors: compare integers and compare floats. + * @param[out] os - Formatted output string holding the compared values. + * @param[in] metric_string - Name of the metric. + * @param[in] v_base - Base value of the metric. + * @param[in] v_current - Current value of the metric. + */ + virtual void compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) ; + virtual void compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) ; + + /** + * @brief Reset internal record count. Count starts with 1. + */ + void resetCurrentCount() { mCount = 1; } + /** + * @brief Increment internal record count. + */ + void incrementCurrentCount() { mCount++; } + /** + * @return Returns the label to be used for the current count. It's "TesterName"-"Count". + */ + std::string getCurrentLabelName() const { return llformat("%s-%d", mName.c_str(), mCount) ;} + + /** + * @brief Write a test record to the LLSD. Implementers need to overload this method. + * @param[out] sd - The LLSD record to store metric data into. + */ + virtual void outputTestRecord(LLSD* sd) = 0 ; + +private: + void preOutputTestResults(LLSD* sd) ; + void postOutputTestResults(LLSD* sd) ; + + std::string mName ; // Name of this tester instance + S32 mCount ; // Current record count + BOOL mValidInstance; // TRUE if the instance is managed by the map + std::vector< std::string > mMetricStrings ; // Metrics strings + +// Static members managing the collection of testers +public: + // Map of all the tester instances in use + typedef std::map< std::string, LLMetricPerformanceTesterBasic* > name_tester_map_t; + static name_tester_map_t sTesterMap ; + + /** + * @return Returns a pointer to the tester + * @param[in] name - Name of the tester instance queried. + */ + static LLMetricPerformanceTesterBasic* getTester(std::string name) ; + /** + * @return Returns TRUE if there's a tester defined, FALSE otherwise. + */ + static BOOL hasMetricPerformanceTesters() { return !sTesterMap.empty() ;} + /** + * @brief Delete all testers and reset the tester map + */ + static void cleanClass() ; + +private: + // Add a tester to the map. Returns false if adding fails. + static BOOL addTester(LLMetricPerformanceTesterBasic* tester) ; +}; + +/** + * @class LLMetricPerformanceTesterWithSession + * @brief Performance Metric Class with custom session + */ +class LL_COMMON_API LLMetricPerformanceTesterWithSession : public LLMetricPerformanceTesterBasic +{ +public: + /** + * @param[in] name - Unique string identifying this tester instance. + */ + LLMetricPerformanceTesterWithSession(std::string name); + virtual ~LLMetricPerformanceTesterWithSession(); + + /** + * @brief Compare the test results. + * This will be loading the base and current sessions and compare them using the virtual + * abstract methods loadTestSession() and compareTestSessions() + */ + virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; + +protected: + /** + * @class LLMetricPerformanceTesterWithSession::LLTestSession + * @brief Defines an interface for the two abstract virtual functions loadTestSession() and compareTestSessions() + */ + class LLTestSession + { + public: + virtual ~LLTestSession() ; + }; + + /** + * @brief Convert an LLSD log into a test session. + * @param[in] log - The LLSD record + * @return Returns the record as a test session + */ + virtual LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) = 0; + + /** + * @brief Compare the base session and the target session. Assumes base and current sessions have been loaded. + * @param[out] os - The comparison result as a standard stream + */ + virtual void compareTestSessions(std::ofstream* os) = 0; + + LLTestSession* mBaseSessionp; + LLTestSession* mCurrentSessionp; +}; + +#endif + -- cgit v1.2.3 From ec57776a23f36a9df02ee614c4f0ef20fcea0c7c Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 15 Sep 2010 15:40:29 -0700 Subject: Add role action to allow hosting of events on group land --- indra/llcommon/roles_constants.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h index 70bca821c7..effd15ea72 100644 --- a/indra/llcommon/roles_constants.h +++ b/indra/llcommon/roles_constants.h @@ -52,7 +52,6 @@ enum LLRoleChangeType // // KNOWN HOLES: use these for any single bit powers you need -// bit 0x1 << 41 // bit 0x1 << 46 // bit 0x1 << 49 and above @@ -103,6 +102,8 @@ const U64 GP_LAND_ALLOW_FLY = 0x1 << 24; // Bypass Fly Restriction const U64 GP_LAND_ALLOW_CREATE = 0x1 << 25; // Bypass Create/Edit Objects Restriction const U64 GP_LAND_ALLOW_LANDMARK = 0x1 << 26; // Bypass Landmark Restriction const U64 GP_LAND_ALLOW_SET_HOME = 0x1 << 28; // Bypass Set Home Point Restriction +const U64 GP_LAND_ALLOW_HOLD_EVENT = 0x1LL << 41; // Allowed to hold events on group-owned land + // Parcel Access const U64 GP_LAND_MANAGE_ALLOWED = 0x1 << 29; // Manage Allowed List -- cgit v1.2.3 From 5ee546eb4e446632c32e62a5234241fd6498f281 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 14 Oct 2010 17:01:39 -0600 Subject: for SH-335: create a debug tool to track of memory availability. --- indra/llcommon/llsys.cpp | 19 +++++++++++++++++++ indra/llcommon/llsys.h | 3 +++ 2 files changed, 22 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 00c94404d4..7a82a17d0b 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -635,6 +635,25 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const } } +void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) const +{ +#if LL_WINDOWS + MEMORYSTATUSEX state; + state.dwLength = sizeof(state); + GlobalMemoryStatusEx(&state); + + avail_physical_mem_kb = (U32)(state.ullAvailPhys/1024) ; + avail_virtual_mem_kb = (U32)(state.ullAvailVirtual/1024) ; + +#else + //do not know how to collect available memory info for other systems. + //leave it blank here for now. + + avail_physical_mem_kb = -1 ; + avail_virtual_mem_kb = -1 ; +#endif +} + void LLMemoryInfo::stream(std::ostream& s) const { #if LL_WINDOWS diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 39af74e5c8..35425f38ed 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -114,6 +114,9 @@ public: ** be returned. */ U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes + + //get the available memory infomation in KiloBytes. + void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) const; }; -- cgit v1.2.3 From 219cd6ecda60e1c48852f582f0994573fd0e10ae Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 14 Oct 2010 21:23:23 -0600 Subject: more debug code for SH-207: viewer crash in LLVertexBuffer::mapBuffer. --- indra/llcommon/llsys.cpp | 3 ++- indra/llcommon/llsys.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 7a82a17d0b..10cdc7087b 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -635,7 +635,8 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const } } -void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) const +//static +void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) { #if LL_WINDOWS MEMORYSTATUSEX state; diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index 35425f38ed..41a4f25000 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -116,7 +116,7 @@ public: U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes //get the available memory infomation in KiloBytes. - void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb) const; + static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb); }; -- cgit v1.2.3 From 730a7d7f5c7be6f589a17f13baf1b77a4bb4bdde Mon Sep 17 00:00:00 2001 From: Dessie Linden Date: Tue, 19 Oct 2010 13:50:27 -0700 Subject: Bumped viewer version to 2.3.0 --- indra/llcommon/llversionviewer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index bd65ce8573..12bddbfeed 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -28,8 +28,8 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 2; -const S32 LL_VERSION_MINOR = 2; -const S32 LL_VERSION_PATCH = 1; +const S32 LL_VERSION_MINOR = 3; +const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; -- cgit v1.2.3 From cbb184d986cbdd09d36cf2b2313726f0f2582cb2 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 20 Oct 2010 12:48:09 -0400 Subject: bump Development version to 2.4 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 12bddbfeed..9391aed8a1 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -28,7 +28,7 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 2; -const S32 LL_VERSION_MINOR = 3; +const S32 LL_VERSION_MINOR = 4; const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; -- cgit v1.2.3 From 243210e0ab0bc1454bcbb3a5325fec199737a7c3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 20 Oct 2010 20:26:47 +0300 Subject: STORM-419 FIXED ' is used uninitialized in this function in lldarray.h Author: Robin Cornelius Ported by: Techwolf Lupindo Reviewed by: Merov Linden --- indra/llcommon/lldarray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h index a8cd03b42a..131b819c99 100644 --- a/indra/llcommon/lldarray.h +++ b/indra/llcommon/lldarray.h @@ -51,7 +51,7 @@ public: LLDynamicArray(S32 size=0) : std::vector(size) { if (size < BlockSize) std::vector::reserve(BlockSize); } - void reset() { std::vector::resize(0); } + void reset() { std::vector::clear(); } // ACCESSORS const Type& get(S32 index) const { return std::vector::operator[](index); } -- cgit v1.2.3 From b3f3fb60999033a7a100102d563e66eaaa876fa3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 20 Oct 2010 21:23:27 +0300 Subject: STORM-417 FIXED Port of SNOW-140 to SG 2.0 : Forced updates not working on Mac The point of this patch is to make the Mac updater code a bit more flexible and reliable than it is right now. The issue is double: * reliability: the string comparison code on the bundle identifier is not UTF8 compliant * flexibility: the bundle identifier is hard coded to match the bundle identifier of LL viewer (i.e. com.secondlife.indra.viewer) so it can't work for another viewer (in particular, it didn't work for Snowglobe). The "bundle identifier" is one of those Mac only thing stored in the Info.plist of a "bundle" (the ".app" folder that's bundling an executable and all its resources and is seen as an application when browsing with the Mac OS X Finder). The patch fixes both issues: * compare correctly UTF8 encoded strings * allow the bundle ID to be passed as a parameter to the updater The patch has really no consequence on LL viewer. It's more a matter of having cleaner, better code. Author: Cypren Christenson Ported and reviewed by: Merov Linden --- indra/llcommon/llversionviewer.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 9391aed8a1..b209e4aa38 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -34,4 +34,8 @@ const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; +#if LL_DARWIN +const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.snowglobe.viewer"; +#endif + #endif -- cgit v1.2.3 From 40979589afc5c91cab977307a1e400315b1c8a8f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 27 Oct 2010 23:15:22 -0700 Subject: STORM-105 : improve decompression perf gathering, allow perf name to be passed on the command line, fix crash in analysis phase --- indra/llcommon/llfasttimer_class.cpp | 1 + indra/llcommon/llfasttimer_class.h | 1 + 2 files changed, 2 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index c45921cdec..bce87ada96 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -56,6 +56,7 @@ bool LLFastTimer::sPauseHistory = 0; bool LLFastTimer::sResetHistory = 0; LLFastTimer::CurTimerData LLFastTimer::sCurTimerData; BOOL LLFastTimer::sLog = FALSE; +std::string LLFastTimer::sLogName = ""; BOOL LLFastTimer::sMetricLog = FALSE; LLMutex* LLFastTimer::sLogLock = NULL; std::queue LLFastTimer::sLogQueue; diff --git a/indra/llcommon/llfasttimer_class.h b/indra/llcommon/llfasttimer_class.h index 1158ac5140..eb9789682b 100644 --- a/indra/llcommon/llfasttimer_class.h +++ b/indra/llcommon/llfasttimer_class.h @@ -211,6 +211,7 @@ public: static std::queue sLogQueue; static BOOL sLog; static BOOL sMetricLog; + static std::string sLogName; static bool sPauseHistory; static bool sResetHistory; static U64 sTimerCycles; -- cgit v1.2.3 From 434109c54e8b941d644fb0c63c2693681c17b2c9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 1 Nov 2010 12:29:09 -0500 Subject: Remove assert from lldictionary that keeps devs from working with mesh viewer and release viewer. --- indra/llcommon/lldictionary.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lldictionary.h b/indra/llcommon/lldictionary.h index 552a805b70..bc3bc3e74a 100644 --- a/indra/llcommon/lldictionary.h +++ b/indra/llcommon/lldictionary.h @@ -78,7 +78,9 @@ protected: virtual Index notFound() const { // default is to assert - llassert(false); + // don't assert -- makes it impossible to work on mesh-development and viewer-development simultaneously + // -- davep 2010.10.29 + //llassert(false); return Index(-1); } void addEntry(Index index, Entry *entry) -- cgit v1.2.3 From 5d7417b40ed8717b3f307ed9e53c249a3a26cf1b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 2 Nov 2010 20:26:38 +0200 Subject: STORM-422 FIXED Added command line option "-disablecrashlogger" to disable crash logger. This is a patch originally written by Robin Cornelius. I made it work with Google Breakpad. --- indra/llcommon/llapp.cpp | 32 ++++++++++++++++++++++++++++++++ indra/llcommon/llapp.h | 6 ++++++ 2 files changed, 38 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index eebd5ed0a6..39daefd1ad 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -90,6 +90,10 @@ S32 LL_HEARTBEAT_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-0) : SIGUSR2; // the static application instance LLApp* LLApp::sApplication = NULL; +// Allows the generation of core files for post mortem under gdb +// and disables crashlogger +BOOL LLApp::sDisableCrashlogger = FALSE; + // Local flag for whether or not to do logging in signal handlers. //static BOOL LLApp::sLogInSignal = FALSE; @@ -461,11 +465,30 @@ bool LLApp::isQuitting() return (APP_STATUS_QUITTING == sStatus); } +// static bool LLApp::isExiting() { return isQuitting() || isError(); } +void LLApp::disableCrashlogger() +{ + // Disable Breakpad exception handler. + if (mExceptionHandler != 0) + { + delete mExceptionHandler; + mExceptionHandler = 0; + } + + sDisableCrashlogger = TRUE; +} + +// static +bool LLApp::isCrashloggerDisabled() +{ + return (sDisableCrashlogger == TRUE); +} + #if !LL_WINDOWS // static U32 LLApp::getSigChildCount() @@ -799,6 +822,15 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *) { llwarns << "Signal handler - Flagging error status and waiting for shutdown" << llendl; } + + if (LLApp::isCrashloggerDisabled()) // Don't gracefully handle any signal, crash and core for a gdb post mortem + { + clear_signals(); + llwarns << "Fatal signal received, not handling the crash here, passing back to operating system" << llendl; + raise(signum); + return; + } + // Flag status to ERROR, so thread_error does its work. LLApp::setError(); // Block in the signal handler until somebody says that we're done. diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h index ee1d696829..a536a06ea5 100644 --- a/indra/llcommon/llapp.h +++ b/indra/llcommon/llapp.h @@ -189,6 +189,11 @@ public: // virtual bool mainLoop() = 0; // Override for the application main loop. Needs to at least gracefully notice the QUITTING state and exit. + // + // Crash logging + // + void disableCrashlogger(); // Let the OS handle the crashes + static bool isCrashloggerDisabled(); // Get the here above set value // // Application status @@ -280,6 +285,7 @@ protected: static void setStatus(EAppStatus status); // Use this to change the application status. static EAppStatus sStatus; // Reflects current application status static BOOL sErrorThreadRunning; // Set while the error thread is running + static BOOL sDisableCrashlogger; // Let the OS handle crashes for us. #if !LL_WINDOWS static LLAtomicU32* sSigChildCount; // Number of SIGCHLDs received. -- cgit v1.2.3 From 85509457c6dc6a0f3e56fa3d24ae872e1878c04f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 5 Nov 2010 18:40:08 -0700 Subject: STORM-105 : Take Vadim code review into account, code clean up --- indra/llcommon/CMakeLists.txt | 4 +- indra/llcommon/llmetricperformancetester.cpp | 142 +++++++++++----------- indra/llcommon/llmetricperformancetester.h | 172 +++++++++++++-------------- 3 files changed, 159 insertions(+), 159 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index a6f07f9600..478f2fedbd 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -55,7 +55,6 @@ set(llcommon_SOURCE_FILES llevents.cpp lleventtimer.cpp llfasttimer_class.cpp - llmetricperformancetester.cpp llfile.cpp llfindlocale.cpp llfixedbuffer.cpp @@ -71,6 +70,7 @@ set(llcommon_SOURCE_FILES llmemorystream.cpp llmemtype.cpp llmetrics.cpp + llmetricperformancetester.cpp llmortician.cpp lloptioninterface.cpp llptrto.cpp @@ -161,7 +161,6 @@ set(llcommon_HEADER_FILES llextendedstatus.h llfasttimer.h llfasttimer_class.h - llmetricperformancetester.h llfile.h llfindlocale.h llfixedbuffer.h @@ -188,6 +187,7 @@ set(llcommon_HEADER_FILES llmemorystream.h llmemtype.h llmetrics.h + llmetricperformancetester.h llmortician.h llnametable.h lloptioninterface.h diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index bd548f199a..2110192fbc 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -52,7 +52,7 @@ void LLMetricPerformanceTesterBasic::cleanClass() /*static*/ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* tester) { - llassert_always(tester != NULL); + llassert_always(tester != NULL); std::string name = tester->getTesterName() ; if (getTester(name)) { @@ -80,7 +80,7 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s //---------------------------------------------------------------------------------------------- LLMetricPerformanceTesterBasic::LLMetricPerformanceTesterBasic(std::string name) : - mName(name), + mName(name), mCount(0) { if (mName == std::string()) @@ -110,7 +110,7 @@ void LLMetricPerformanceTesterBasic::postOutputTestResults(LLSD* sd) void LLMetricPerformanceTesterBasic::outputTestResults() { LLSD sd; - + preOutputTestResults(&sd) ; outputTestRecord(&sd) ; postOutputTestResults(&sd) ; @@ -124,43 +124,43 @@ void LLMetricPerformanceTesterBasic::addMetric(std::string str) /*virtual*/ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) { - resetCurrentCount() ; - - std::string currentLabel = getCurrentLabelName(); - BOOL in_base = (*base).has(currentLabel) ; - BOOL in_current = (*current).has(currentLabel) ; - - while(in_base || in_current) - { - LLSD::String label = currentLabel ; - - if(in_base && in_current) - { - *os << llformat("%s\n", label.c_str()) ; - - for(U32 index = 0 ; index < mMetricStrings.size() ; index++) - { - switch((*current)[label][ mMetricStrings[index] ].type()) - { - case LLSD::TypeInteger: - compareTestResults(os, mMetricStrings[index], - (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; - break ; - case LLSD::TypeReal: - compareTestResults(os, mMetricStrings[index], - (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; - break; - default: - llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; - } - } - } - - incrementCurrentCount(); - currentLabel = getCurrentLabelName(); - in_base = (*base).has(currentLabel) ; - in_current = (*current).has(currentLabel) ; - } + resetCurrentCount() ; + + std::string currentLabel = getCurrentLabelName(); + BOOL in_base = (*base).has(currentLabel) ; + BOOL in_current = (*current).has(currentLabel) ; + + while(in_base || in_current) + { + LLSD::String label = currentLabel ; + + if(in_base && in_current) + { + *os << llformat("%s\n", label.c_str()) ; + + for(U32 index = 0 ; index < mMetricStrings.size() ; index++) + { + switch((*current)[label][ mMetricStrings[index] ].type()) + { + case LLSD::TypeInteger: + compareTestResults(os, mMetricStrings[index], + (S32)((*base)[label][ mMetricStrings[index] ].asInteger()), (S32)((*current)[label][ mMetricStrings[index] ].asInteger())) ; + break ; + case LLSD::TypeReal: + compareTestResults(os, mMetricStrings[index], + (F32)((*base)[label][ mMetricStrings[index] ].asReal()), (F32)((*current)[label][ mMetricStrings[index] ].asReal())) ; + break; + default: + llerrs << "unsupported metric " << mMetricStrings[index] << " LLSD type: " << (S32)(*current)[label][ mMetricStrings[index] ].type() << llendl ; + } + } + } + + incrementCurrentCount(); + currentLabel = getCurrentLabelName(); + in_base = (*base).has(currentLabel) ; + in_current = (*current).has(currentLabel) ; + } } /*virtual*/ @@ -182,12 +182,12 @@ void LLMetricPerformanceTesterBasic::compareTestResults(std::ofstream* os, std:: //---------------------------------------------------------------------------------------------- LLMetricPerformanceTesterWithSession::LLMetricPerformanceTesterWithSession(std::string name) : - LLMetricPerformanceTesterBasic(name), - mBaseSessionp(NULL), - mCurrentSessionp(NULL) + LLMetricPerformanceTesterBasic(name), + mBaseSessionp(NULL), + mCurrentSessionp(NULL) { } - + LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() { if (mBaseSessionp) @@ -205,33 +205,33 @@ LLMetricPerformanceTesterWithSession::~LLMetricPerformanceTesterWithSession() /*virtual*/ void LLMetricPerformanceTesterWithSession::analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) { - // Load the base session - resetCurrentCount() ; - mBaseSessionp = loadTestSession(base) ; - - // Load the current session - resetCurrentCount() ; - mCurrentSessionp = loadTestSession(current) ; - - if (!mBaseSessionp || !mCurrentSessionp) - { - llerrs << "Error loading test sessions." << llendl ; - } - - // Compare - compareTestSessions(os) ; - - // Release memory - if (mBaseSessionp) - { - delete mBaseSessionp ; - mBaseSessionp = NULL ; - } - if (mCurrentSessionp) - { - delete mCurrentSessionp ; - mCurrentSessionp = NULL ; - } + // Load the base session + resetCurrentCount() ; + mBaseSessionp = loadTestSession(base) ; + + // Load the current session + resetCurrentCount() ; + mCurrentSessionp = loadTestSession(current) ; + + if (!mBaseSessionp || !mCurrentSessionp) + { + llerrs << "Error loading test sessions." << llendl ; + } + + // Compare + compareTestSessions(os) ; + + // Release memory + if (mBaseSessionp) + { + delete mBaseSessionp ; + mBaseSessionp = NULL ; + } + if (mCurrentSessionp) + { + delete mCurrentSessionp ; + mCurrentSessionp = NULL ; + } } diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 82d579b188..6fd1d41daa 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -35,114 +35,114 @@ class LL_COMMON_API LLMetricPerformanceTesterBasic { public: /** - * @brief Creates a basic tester instance. - * @param[in] name - Unique string identifying this tester instance. - */ + * @brief Creates a basic tester instance. + * @param[in] name - Unique string identifying this tester instance. + */ LLMetricPerformanceTesterBasic(std::string name); virtual ~LLMetricPerformanceTesterBasic(); /** - * @return Returns true if the instance has been added to the tester map. - * Need to be tested after creation of a tester instance so to know if the tester is correctly handled. - * A tester might not be added to the map if another tester with the same name already exists. - */ - BOOL isValid() const { return mValidInstance; } + * @return Returns true if the instance has been added to the tester map. + * Need to be tested after creation of a tester instance so to know if the tester is correctly handled. + * A tester might not be added to the map if another tester with the same name already exists. + */ + BOOL isValid() const { return mValidInstance; } /** - * @brief Write a set of test results to the log LLSD. - */ + * @brief Write a set of test results to the log LLSD. + */ void outputTestResults() ; - + /** - * @brief Compare the test results. - * By default, compares the test results against the baseline one by one, item by item, - * in the increasing order of the LLSD record counter, starting from the first one. - */ + * @brief Compare the test results. + * By default, compares the test results against the baseline one by one, item by item, + * in the increasing order of the LLSD record counter, starting from the first one. + */ virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; - + /** - * @return Returns the number of the test metrics in this tester instance. - */ + * @return Returns the number of the test metrics in this tester instance. + */ S32 getNumberOfMetrics() const { return mMetricStrings.size() ;} /** - * @return Returns the metric name at index - * @param[in] index - Index on the list of metrics managed by this tester instance. - */ + * @return Returns the metric name at index + * @param[in] index - Index on the list of metrics managed by this tester instance. + */ std::string getMetricName(S32 index) const { return mMetricStrings[index] ;} - + protected: /** - * @return Returns the name of this tester instance. - */ + * @return Returns the name of this tester instance. + */ std::string getTesterName() const { return mName ;} - + /** - * @brief Insert a new metric to be managed by this tester instance. - * @param[in] str - Unique string identifying the new metric. - */ + * @brief Insert a new metric to be managed by this tester instance. + * @param[in] str - Unique string identifying the new metric. + */ void addMetric(std::string str) ; /** - * @brief Compare test results, provided in 2 flavors: compare integers and compare floats. - * @param[out] os - Formatted output string holding the compared values. - * @param[in] metric_string - Name of the metric. - * @param[in] v_base - Base value of the metric. - * @param[in] v_current - Current value of the metric. - */ + * @brief Compare test results, provided in 2 flavors: compare integers and compare floats. + * @param[out] os - Formatted output string holding the compared values. + * @param[in] metric_string - Name of the metric. + * @param[in] v_base - Base value of the metric. + * @param[in] v_current - Current value of the metric. + */ virtual void compareTestResults(std::ofstream* os, std::string metric_string, S32 v_base, S32 v_current) ; virtual void compareTestResults(std::ofstream* os, std::string metric_string, F32 v_base, F32 v_current) ; - + /** - * @brief Reset internal record count. Count starts with 1. - */ + * @brief Reset internal record count. Count starts with 1. + */ void resetCurrentCount() { mCount = 1; } /** - * @brief Increment internal record count. - */ + * @brief Increment internal record count. + */ void incrementCurrentCount() { mCount++; } /** - * @return Returns the label to be used for the current count. It's "TesterName"-"Count". - */ - std::string getCurrentLabelName() const { return llformat("%s-%d", mName.c_str(), mCount) ;} - - /** - * @brief Write a test record to the LLSD. Implementers need to overload this method. - * @param[out] sd - The LLSD record to store metric data into. - */ + * @return Returns the label to be used for the current count. It's "TesterName"-"Count". + */ + std::string getCurrentLabelName() const { return llformat("%s-%d", mName.c_str(), mCount) ;} + + /** + * @brief Write a test record to the LLSD. Implementers need to overload this method. + * @param[out] sd - The LLSD record to store metric data into. + */ virtual void outputTestRecord(LLSD* sd) = 0 ; private: void preOutputTestResults(LLSD* sd) ; void postOutputTestResults(LLSD* sd) ; - std::string mName ; // Name of this tester instance - S32 mCount ; // Current record count - BOOL mValidInstance; // TRUE if the instance is managed by the map + std::string mName ; // Name of this tester instance + S32 mCount ; // Current record count + BOOL mValidInstance; // TRUE if the instance is managed by the map std::vector< std::string > mMetricStrings ; // Metrics strings // Static members managing the collection of testers public: - // Map of all the tester instances in use + // Map of all the tester instances in use typedef std::map< std::string, LLMetricPerformanceTesterBasic* > name_tester_map_t; static name_tester_map_t sTesterMap ; /** - * @return Returns a pointer to the tester - * @param[in] name - Name of the tester instance queried. - */ + * @return Returns a pointer to the tester + * @param[in] name - Name of the tester instance queried. + */ static LLMetricPerformanceTesterBasic* getTester(std::string name) ; /** - * @return Returns TRUE if there's a tester defined, FALSE otherwise. - */ + * @return Returns TRUE if there's a tester defined, FALSE otherwise. + */ static BOOL hasMetricPerformanceTesters() { return !sTesterMap.empty() ;} /** - * @brief Delete all testers and reset the tester map - */ + * @brief Delete all testers and reset the tester map + */ static void cleanClass() ; private: - // Add a tester to the map. Returns false if adding fails. - static BOOL addTester(LLMetricPerformanceTesterBasic* tester) ; + // Add a tester to the map. Returns false if adding fails. + static BOOL addTester(LLMetricPerformanceTesterBasic* tester) ; }; /** @@ -153,42 +153,42 @@ class LL_COMMON_API LLMetricPerformanceTesterWithSession : public LLMetricPerfor { public: /** - * @param[in] name - Unique string identifying this tester instance. - */ + * @param[in] name - Unique string identifying this tester instance. + */ LLMetricPerformanceTesterWithSession(std::string name); virtual ~LLMetricPerformanceTesterWithSession(); /** - * @brief Compare the test results. - * This will be loading the base and current sessions and compare them using the virtual - * abstract methods loadTestSession() and compareTestSessions() - */ + * @brief Compare the test results. + * This will be loading the base and current sessions and compare them using the virtual + * abstract methods loadTestSession() and compareTestSessions() + */ virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; protected: - /** - * @class LLMetricPerformanceTesterWithSession::LLTestSession - * @brief Defines an interface for the two abstract virtual functions loadTestSession() and compareTestSessions() - */ - class LLTestSession - { - public: - virtual ~LLTestSession() ; - }; - - /** - * @brief Convert an LLSD log into a test session. - * @param[in] log - The LLSD record - * @return Returns the record as a test session - */ + /** + * @class LLMetricPerformanceTesterWithSession::LLTestSession + * @brief Defines an interface for the two abstract virtual functions loadTestSession() and compareTestSessions() + */ + class LL_COMMON_API LLTestSession + { + public: + virtual ~LLTestSession() ; + }; + + /** + * @brief Convert an LLSD log into a test session. + * @param[in] log - The LLSD record + * @return Returns the record as a test session + */ virtual LLMetricPerformanceTesterWithSession::LLTestSession* loadTestSession(LLSD* log) = 0; - + /** - * @brief Compare the base session and the target session. Assumes base and current sessions have been loaded. - * @param[out] os - The comparison result as a standard stream - */ + * @brief Compare the base session and the target session. Assumes base and current sessions have been loaded. + * @param[out] os - The comparison result as a standard stream + */ virtual void compareTestSessions(std::ofstream* os) = 0; - + LLTestSession* mBaseSessionp; LLTestSession* mCurrentSessionp; }; -- cgit v1.2.3 From 3fa059409aad9d7b5aedb4ed112cb52da6990ac4 Mon Sep 17 00:00:00 2001 From: Bill Curtis Date: Mon, 8 Nov 2010 10:54:58 -0800 Subject: changes to read max-agent-groups from login.cgi response --- indra/llcommon/indra_constants.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index b0618bfe59..ccdb8a413d 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -245,9 +245,6 @@ const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only const U8 SIM_ACCESS_DOWN = 254; const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT; -// group constants -const S32 MAX_AGENT_GROUPS = 25; - // attachment constants const S32 MAX_AGENT_ATTACHMENTS = 38; const U8 ATTACHMENT_ADD = 0x80; -- cgit v1.2.3 From b5df1d2abcef04ee5f491a7414189f4e82faaa1e Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 8 Nov 2010 17:16:31 -0800 Subject: STORM-105 : takes Vadim's comments into account, clean up use of static globals and magic strings, enforce naming conventions --- indra/llcommon/llmetricperformancetester.cpp | 23 ++++++++++++++++------- indra/llcommon/llmetricperformancetester.h | 9 +++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 2110192fbc..5fa3a5ea07 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -67,6 +67,7 @@ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* t /*static*/ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name) { + // Check for the requested metric name name_tester_map_t::iterator found_it = sTesterMap.find(name) ; if (found_it != sTesterMap.end()) { @@ -74,6 +75,14 @@ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::s } return NULL ; } + +/*static*/ +// Return TRUE if this metric is requested or if the general default "catch all" metric is requested +BOOL LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name) +{ + return (LLFastTimer::sMetricLog && ((LLFastTimer::sLogName == name) || (LLFastTimer::sLogName == DEFAULT_METRIC_NAME))); +} + //---------------------------------------------------------------------------------------------- // LLMetricPerformanceTesterBasic : Tester instance methods @@ -126,13 +135,13 @@ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* { resetCurrentCount() ; - std::string currentLabel = getCurrentLabelName(); - BOOL in_base = (*base).has(currentLabel) ; - BOOL in_current = (*current).has(currentLabel) ; + std::string current_label = getCurrentLabelName(); + BOOL in_base = (*base).has(current_label) ; + BOOL in_current = (*current).has(current_label) ; while(in_base || in_current) { - LLSD::String label = currentLabel ; + LLSD::String label = current_label ; if(in_base && in_current) { @@ -157,9 +166,9 @@ void LLMetricPerformanceTesterBasic::analyzePerformance(std::ofstream* os, LLSD* } incrementCurrentCount(); - currentLabel = getCurrentLabelName(); - in_base = (*base).has(currentLabel) ; - in_current = (*current).has(currentLabel) ; + current_label = getCurrentLabelName(); + in_base = (*base).has(current_label) ; + in_current = (*current).has(current_label) ; } } diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 6fd1d41daa..925010ac96 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -27,6 +27,8 @@ #ifndef LL_METRICPERFORMANCETESTER_H #define LL_METRICPERFORMANCETESTER_H +const std::string DEFAULT_METRIC_NAME("metric"); + /** * @class LLMetricPerformanceTesterBasic * @brief Performance Metric Base Class @@ -131,6 +133,13 @@ public: * @param[in] name - Name of the tester instance queried. */ static LLMetricPerformanceTesterBasic* getTester(std::string name) ; + + /** + * @return Returns TRUE if that metric *or* the default catch all metric has been requested to be logged + * @param[in] name - Name of the tester queried. + */ + static BOOL isMetricLogRequested(std::string name); + /** * @return Returns TRUE if there's a tester defined, FALSE otherwise. */ -- cgit v1.2.3 From 73b6d4d058107137425cd202e79fb0a2d9c22896 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 9 Nov 2010 11:15:01 -0800 Subject: Fix crash if thread is manually shut down before it is destroyed. --- indra/llcommon/llthread.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index d7b7c3699c..2408be74b9 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -153,10 +153,12 @@ void LLThread::shutdown() } delete mRunCondition; + mRunCondition = 0; - if (mIsLocalPool) + if (mIsLocalPool && mAPRPoolp) { apr_pool_destroy(mAPRPoolp); + mAPRPoolp = 0; } } -- cgit v1.2.3 From 9ae2891a3afefcbf0c72cadaef203426cb0e5954 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 9 Nov 2010 15:04:44 -0800 Subject: start of a thread safe queue --- indra/llcommon/CMakeLists.txt | 2 + indra/llcommon/llthreadsafequeue.cpp | 109 +++++++++++++++++++ indra/llcommon/llthreadsafequeue.h | 205 +++++++++++++++++++++++++++++++++++ 3 files changed, 316 insertions(+) create mode 100644 indra/llcommon/llthreadsafequeue.cpp create mode 100644 indra/llcommon/llthreadsafequeue.h (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 7bad780dd8..7d53667f35 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -92,6 +92,7 @@ set(llcommon_SOURCE_FILES llstringtable.cpp llsys.cpp llthread.cpp + llthreadsafequeue.cpp lltimer.cpp lluri.cpp lluuid.cpp @@ -223,6 +224,7 @@ set(llcommon_HEADER_FILES llstringtable.h llsys.h llthread.h + llthreadsafequeue.h lltimer.h lltreeiterators.h lluri.h diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp new file mode 100644 index 0000000000..a7141605ef --- /dev/null +++ b/indra/llcommon/llthreadsafequeue.cpp @@ -0,0 +1,109 @@ +/** + * @file llthread.cpp + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" +#include +#include +#include "llthreadsafequeue.h" + + + +// LLThreadSafeQueueImplementation +//----------------------------------------------------------------------------- + + +LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity): + mOwnsPool(pool == 0), + mPool(pool), + mQueue(0) +{ + if(mOwnsPool) { + apr_status_t status = apr_pool_create(&mPool, 0); + if(status != APR_SUCCESS) throw LLThreadSafeQueueError("failed to allocate pool"); + } else { + ; // No op. + } + + apr_status_t status = apr_queue_create(&mQueue, capacity, mPool); + if(status != APR_SUCCESS) throw LLThreadSafeQueueError("failed to allocate queue"); +} + + +LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation() +{ + if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool); + if(mQueue != 0) { + if(apr_queue_size(mQueue) != 0) llwarns << + "terminating queue which still contains elements;" << + "memory will be leaked" << LL_ENDL; + apr_queue_term(mQueue); + } +} + + +void LLThreadSafeQueueImplementation::pushFront(void * element) +{ + apr_status_t status = apr_queue_push(mQueue, element); + + if(status == APR_EINTR) { + throw LLThreadSafeQueueInterrupt(); + } else if(status != APR_SUCCESS) { + throw LLThreadSafeQueueError("push failed"); + } else { + ; // Success. + } +} + + +bool LLThreadSafeQueueImplementation::tryPushFront(void * element){ + return apr_queue_trypush(mQueue, element) == APR_SUCCESS; +} + + +void * LLThreadSafeQueueImplementation::popBack(void) +{ + void * element; + apr_status_t status = apr_queue_pop(mQueue, &element); + + if(status == APR_EINTR) { + throw LLThreadSafeQueueInterrupt(); + } else if(status != APR_SUCCESS) { + throw LLThreadSafeQueueError("pop failed"); + } else { + return element; + } +} + + +bool LLThreadSafeQueueImplementation::tryPopBack(void *& element) +{ + return apr_queue_trypop(mQueue, &element) == APR_SUCCESS; +} + + +size_t LLThreadSafeQueueImplementation::size() +{ + return apr_queue_size(mQueue); +} diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h new file mode 100644 index 0000000000..46c8b91932 --- /dev/null +++ b/indra/llcommon/llthreadsafequeue.h @@ -0,0 +1,205 @@ +/** + * @file llthreadsafequeue.h + * @brief Base classes for thread, mutex and condition handling. + * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLTHREADSAFEQUEUE_H +#define LL_LLTHREADSAFEQUEUE_H + + +#include +#include + + +struct apr_pool_t; // From apr_pools.h +class LLThreadSafeQueueImplementation; // See below. + + +// +// A general queue exception. +// +class LLThreadSafeQueueError: +public std::runtime_error +{ +public: + LLThreadSafeQueueError(std::string const & message): + std::runtime_error(message) + { + ; // No op. + } +}; + + +// +// An exception raised when blocking operations are interrupted. +// +class LLThreadSafeQueueInterrupt: + public LLThreadSafeQueueError +{ +public: + LLThreadSafeQueueInterrupt(void): + LLThreadSafeQueueError("queue operation interrupted") + { + ; // No op. + } +}; + + +struct apr_queue_t; // From apr_queue.h + + +// +// Implementation details. +// +class LLThreadSafeQueueImplementation +{ +public: + LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity); + ~LLThreadSafeQueueImplementation(); + void pushFront(void * element); + bool tryPushFront(void * element); + void * popBack(void); + bool tryPopBack(void *& element); + size_t size(); + +private: + bool mOwnsPool; + apr_pool_t * mPool; + apr_queue_t * mQueue; +}; + + +// +// Implements a thread safe FIFO. +// +template +class LLThreadSafeQueue +{ +public: + typedef ElementT value_type; + + // If the pool is set to NULL one will be allocated and managed by this + // queue. + LLThreadSafeQueue(apr_pool_t * pool = 0, unsigned int capacity = 1024); + + // Add an element to the front of queue (will block if the queue has + // reached capacity). + // + // This call will raise an interrupt error if the queue is deleted while + // the caller is blocked. + void pushFront(ElementT const & element); + + // Try to add an element to the front ofqueue without blocking. Returns + // true only if the element was actually added. + bool tryPushFront(ElementT const & element); + + // Pop the element at the end of the queue (will block if the queue is + // empty). + // + // This call will raise an interrupt error if the queue is deleted while + // the caller is blocked. + ElementT popBack(void); + + // Pop an element from the end of the queue if there is one available. + // Returns true only if an element was popped. + bool tryPopBack(ElementT & element); + + // Returns the size of the queue. + size_t size(); + +private: + LLThreadSafeQueueImplementation mImplementation; +}; + + + +// LLThreadSafeQueue +//----------------------------------------------------------------------------- + + +template +LLThreadSafeQueue::LLThreadSafeQueue(apr_pool_t * pool, unsigned int capacity): + mImplementation(pool, capacity) +{ + ; // No op. +} + + +template +void LLThreadSafeQueue::pushFront(ElementT const & element) +{ + ElementT * elementCopy = new ElementT(element); + try { + mImplementation.pushFront(elementCopy); + } catch (LLThreadSafeQueueInterrupt) { + delete elementCopy; + throw; + } +} + + +template +bool LLThreadSafeQueue::tryPushFront(ElementT const & element) +{ + ElementT * elementCopy = new ElementT(element); + bool result = mImplementation.tryPushFront(elementCopy); + if(!result) delete elementCopy; + return result; +} + + +template +ElementT LLThreadSafeQueue::popBack(void) +{ + ElementT * element = reinterpret_cast (mImplementation.popBack()); + ElementT result(*element); + delete element; + return result; +} + + +template +bool LLThreadSafeQueue::tryPopBack(ElementT & element) +{ + void * storedElement; + bool result = mImplementation.tryPopBack(storedElement); + if(result) { + ElementT * elementPtr = reinterpret_cast(storedElement); + element = *elementPtr; + delete elementPtr; + } else { + ; // No op. + } + return result; +} + + +template +size_t LLThreadSafeQueue::size(void) +{ + return mImplementation.size(); +} + + +#endif -- cgit v1.2.3 From e87b447a0ca7c6e4aeb5f87e6767db918682499c Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Tue, 9 Nov 2010 17:42:13 -0800 Subject: Fix for dll linkage errors. --- indra/llcommon/llthreadsafequeue.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthreadsafequeue.h b/indra/llcommon/llthreadsafequeue.h index 46c8b91932..58cac38769 100644 --- a/indra/llcommon/llthreadsafequeue.h +++ b/indra/llcommon/llthreadsafequeue.h @@ -39,7 +39,7 @@ class LLThreadSafeQueueImplementation; // See below. // // A general queue exception. // -class LLThreadSafeQueueError: +class LL_COMMON_API LLThreadSafeQueueError: public std::runtime_error { public: @@ -54,7 +54,7 @@ public: // // An exception raised when blocking operations are interrupted. // -class LLThreadSafeQueueInterrupt: +class LL_COMMON_API LLThreadSafeQueueInterrupt: public LLThreadSafeQueueError { public: @@ -72,7 +72,7 @@ struct apr_queue_t; // From apr_queue.h // // Implementation details. // -class LLThreadSafeQueueImplementation +class LL_COMMON_API LLThreadSafeQueueImplementation { public: LLThreadSafeQueueImplementation(apr_pool_t * pool, unsigned int capacity); -- cgit v1.2.3 From 7a7f89db6d9c5e6b2c6c89ea39c0302907a0442b Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 11 Nov 2010 11:46:24 -0800 Subject: fix termination issues with thread safe queue in main loop repeater service. --- indra/llcommon/llthreadsafequeue.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthreadsafequeue.cpp b/indra/llcommon/llthreadsafequeue.cpp index a7141605ef..8a73e632a9 100644 --- a/indra/llcommon/llthreadsafequeue.cpp +++ b/indra/llcommon/llthreadsafequeue.cpp @@ -53,13 +53,13 @@ LLThreadSafeQueueImplementation::LLThreadSafeQueueImplementation(apr_pool_t * po LLThreadSafeQueueImplementation::~LLThreadSafeQueueImplementation() { - if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool); if(mQueue != 0) { if(apr_queue_size(mQueue) != 0) llwarns << - "terminating queue which still contains elements;" << - "memory will be leaked" << LL_ENDL; + "terminating queue which still contains " << apr_queue_size(mQueue) << + " elements;" << "memory will be leaked" << LL_ENDL; apr_queue_term(mQueue); } + if(mOwnsPool && (mPool != 0)) apr_pool_destroy(mPool); } -- cgit v1.2.3 From 830afa5b27092668517b2f5670e892143de3cf66 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 11 Nov 2010 16:45:38 -0800 Subject: hacking mac updater to install from local dmg --- indra/llcommon/llthread.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 2408be74b9..148aaf8aed 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -147,6 +147,8 @@ void LLThread::shutdown() { // This thread just wouldn't stop, even though we gave it time llwarns << "LLThread::~LLThread() exiting thread before clean exit!" << llendl; + // Put a stake in its heart. + apr_thread_exit(mAPRThreadp, -1); return; } mAPRThreadp = NULL; -- cgit v1.2.3 From b2fcba25c8dd04318420af30f877b0984a524055 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Sat, 13 Nov 2010 00:53:29 +0200 Subject: STORM-52 FIXED Made it possible to use an external script editor. The editor can be specified: * via "ExternalEditor" setting in settings.xml * via LL_SCRIPT_EDITOR variable Removed obsolete XUIEditor setting in favor of the new one. --- indra/llcommon/llprocesslauncher.cpp | 5 +++++ indra/llcommon/llprocesslauncher.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llprocesslauncher.cpp b/indra/llcommon/llprocesslauncher.cpp index 99308c94e7..81e5f8820d 100644 --- a/indra/llcommon/llprocesslauncher.cpp +++ b/indra/llcommon/llprocesslauncher.cpp @@ -58,6 +58,11 @@ void LLProcessLauncher::setWorkingDirectory(const std::string &dir) mWorkingDir = dir; } +const std::string& LLProcessLauncher::getExecutable() const +{ + return mExecutable; +} + void LLProcessLauncher::clearArguments() { mLaunchArguments.clear(); diff --git a/indra/llcommon/llprocesslauncher.h b/indra/llcommon/llprocesslauncher.h index 479aeb664a..954c249147 100644 --- a/indra/llcommon/llprocesslauncher.h +++ b/indra/llcommon/llprocesslauncher.h @@ -47,6 +47,8 @@ public: void setExecutable(const std::string &executable); void setWorkingDirectory(const std::string &dir); + const std::string& getExecutable() const; + void clearArguments(); void addArgument(const std::string &arg); void addArgument(const char *arg); -- cgit v1.2.3 From c5e5af4219b650db50ec72ee6a7174aad9439671 Mon Sep 17 00:00:00 2001 From: Bill Curtis Date: Thu, 18 Nov 2010 10:37:45 -0800 Subject: added logging and default value for max-agent-groups --- indra/llcommon/indra_constants.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index ccdb8a413d..95cb606240 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -297,6 +297,14 @@ const U32 START_LOCATION_ID_COUNT = 6; // group constants const U32 GROUP_MIN_SIZE = 2; +// gMaxAgentGroups is now sent by login.cgi, which +// looks it up from globals.xml. +// +// For now we need an old default value however, +// so the viewer can be deployed ahead of login.cgi. +// +const S32 DEFAULT_MAX_AGENT_GROUPS = 25; + // radius within which a chat message is fully audible const F32 CHAT_WHISPER_RADIUS = 10.f; const F32 CHAT_NORMAL_RADIUS = 20.f; -- cgit v1.2.3 From 8c2026d6b71f133deafa6b0e19baf69632a2510a Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Thu, 18 Nov 2010 21:57:27 -0800 Subject: CHOP-135 Bug fixes. --- indra/llcommon/llfile.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index 289ce0bc2c..8f02391e75 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -318,7 +318,12 @@ void llofstream::close() if(is_open()) { if (_Filebuffer->close() == 0) + { _Myios::setstate(ios_base::failbit); /*Flawfinder: ignore*/ + } + delete _Filebuffer; + _Filebuffer = NULL; + _ShouldClose = false; } } -- cgit v1.2.3 From 02701073ce70fc2e2043adf0ed7e0d6879669215 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 22 Nov 2010 09:53:01 -0500 Subject: increment viewer version number to 2.5 --- indra/llcommon/llversionviewer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index b209e4aa38..d6fa5b1997 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -28,7 +28,7 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 2; -const S32 LL_VERSION_MINOR = 4; +const S32 LL_VERSION_MINOR = 5; const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; -- cgit v1.2.3 From 5c70975179d21fbd96dbf5de31c4c92c2b384f78 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Tue, 23 Nov 2010 11:40:54 -0800 Subject: [mq]: thread_state_fix --- indra/llcommon/llthread.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 148aaf8aed..49d05ef411 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -63,9 +63,6 @@ void *APR_THREAD_FUNC LLThread::staticRun(apr_thread_t *apr_threadp, void *datap { LLThread *threadp = (LLThread *)datap; - // Set thread state to running - threadp->mStatus = RUNNING; - // Run the user supplied function threadp->run(); @@ -167,10 +164,25 @@ void LLThread::shutdown() void LLThread::start() { - apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp); + llassert(isStopped()); + + // Set thread state to running + mStatus = RUNNING; - // We won't bother joining - apr_thread_detach(mAPRThreadp); + apr_status_t status = + apr_thread_create(&mAPRThreadp, NULL, staticRun, (void *)this, mAPRPoolp); + + if(status == APR_SUCCESS) + { + // We won't bother joining + apr_thread_detach(mAPRThreadp); + } + else + { + mStatus = STOPPED; + llwarns << "failed to start thread " << mName << llendl; + ll_apr_warn_status(status); + } } //============================================================================ -- cgit v1.2.3