summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Madarasz (Graham) <graham@lindenlab.com>2013-02-28 15:35:14 -0800
committerGraham Madarasz (Graham) <graham@lindenlab.com>2013-02-28 15:35:14 -0800
commit93eaccae6fe6e8442a3c6e5a2d40a408aa44df77 (patch)
tree7e115b8278532bb100b07b8ed56d213b383d4c96 /indra
parent2dcbbf04c9375e2de877956476e0a58219a169cf (diff)
Modify LLInstanceTracker to avoid using a map of strings to find a map of foo to find some pointers
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lleventapi.h5
-rw-r--r--indra/llcommon/lleventtimer.h3
-rw-r--r--indra/llcommon/llfasttimer.h5
-rw-r--r--indra/llcommon/llinstancetracker.cpp14
-rw-r--r--indra/llcommon/llinstancetracker.h46
-rw-r--r--indra/llcommon/llleap.h3
-rw-r--r--indra/llrender/llgl.h4
-rw-r--r--indra/llui/llconsole.h3
-rw-r--r--indra/llui/llfloater.h5
-rw-r--r--indra/llui/lllayoutstack.h3
-rw-r--r--indra/llui/llnotifications.h5
-rw-r--r--indra/llwindow/llwindow.h3
-rw-r--r--indra/llxml/llcontrol.cpp2
-rw-r--r--indra/llxml/llcontrol.h10
-rw-r--r--indra/newview/lldrawable.cpp6
-rw-r--r--indra/newview/llfloaterwebcontent.cpp2
-rw-r--r--indra/newview/llfloaterwebcontent.h5
-rw-r--r--indra/newview/llmediactrl.cpp2
-rw-r--r--indra/newview/llmediactrl.h3
-rw-r--r--indra/newview/llnamelistctrl.h3
-rw-r--r--indra/newview/lltoast.cpp2
-rw-r--r--indra/newview/lltoast.h3
22 files changed, 90 insertions, 47 deletions
diff --git a/indra/llcommon/lleventapi.h b/indra/llcommon/lleventapi.h
index 1a37d780b6..10c7e7a23f 100644
--- a/indra/llcommon/lleventapi.h
+++ b/indra/llcommon/lleventapi.h
@@ -41,12 +41,13 @@
* Deriving from LLInstanceTracker lets us enumerate instances.
*/
class LL_COMMON_API LLEventAPI: public LLDispatchListener,
- public LLInstanceTracker<LLEventAPI, std::string>
+ public INSTANCE_TRACKER_KEYED(LLEventAPI, std::string)
{
typedef LLDispatchListener lbase;
- typedef LLInstanceTracker<LLEventAPI, std::string> ibase;
+ typedef INSTANCE_TRACKER_KEYED(LLEventAPI, std::string) ibase;
public:
+
/**
* @param name LLEventPump name on which this LLEventAPI will listen. This
* also serves as the LLInstanceTracker instance key.
diff --git a/indra/llcommon/lleventtimer.h b/indra/llcommon/lleventtimer.h
index 7f42623d01..e55f851758 100644
--- a/indra/llcommon/lleventtimer.h
+++ b/indra/llcommon/lleventtimer.h
@@ -33,9 +33,10 @@
#include "lltimer.h"
// class for scheduling a function to be called at a given frequency (approximate, inprecise)
-class LL_COMMON_API LLEventTimer : public LLInstanceTracker<LLEventTimer>
+class LL_COMMON_API LLEventTimer : public INSTANCE_TRACKER(LLEventTimer)
{
public:
+
LLEventTimer(F32 period); // period is the amount of time between each call to tick() in seconds
LLEventTimer(const LLDate& time);
virtual ~LLEventTimer();
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index e42e549df5..440d42ab5a 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -63,7 +63,7 @@ public:
// stores a "named" timer instance to be reused via multiple LLFastTimer stack instances
class LL_COMMON_API NamedTimer
- : public LLInstanceTracker<NamedTimer>
+ : public LLInstanceTracker<NamedTimer, InstanceTrackType_NamedTimer >
{
friend class DeclareTimer;
public:
@@ -137,10 +137,11 @@ public:
// used to statically declare a new named timer
class LL_COMMON_API DeclareTimer
- : public LLInstanceTracker<DeclareTimer>
+ : public LLInstanceTracker< DeclareTimer, InstanceTrackType_DeclareTimer >
{
friend class LLFastTimer;
public:
+
DeclareTimer(const std::string& name, bool open);
DeclareTimer(const std::string& name);
diff --git a/indra/llcommon/llinstancetracker.cpp b/indra/llcommon/llinstancetracker.cpp
index 5dc3ea5d7b..0804be358f 100644
--- a/indra/llcommon/llinstancetracker.cpp
+++ b/indra/llcommon/llinstancetracker.cpp
@@ -32,18 +32,14 @@
// external library headers
// other Linden headers
-//static
-void * & LLInstanceTrackerBase::getInstances(std::type_info const & info)
-{
- typedef std::map<std::string, void *> InstancesMap;
- static InstancesMap instances;
+static void* sInstanceTrackerData[ kInstanceTrackTypeCount ] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+void * & LLInstanceTrackerBase::getInstances(InstanceTrackType t)
+{
// std::map::insert() is just what we want here. You attempt to insert a
// (key, value) pair. If the specified key doesn't yet exist, it inserts
// the pair and returns a std::pair of (iterator, true). If the specified
// key DOES exist, insert() simply returns (iterator, false). One lookup
// handles both cases.
- return instances.insert(InstancesMap::value_type(info.name(),
- InstancesMap::mapped_type()))
- .first->second;
-}
+ return sInstanceTrackerData[t];
+} \ No newline at end of file
diff --git a/indra/llcommon/llinstancetracker.h b/indra/llcommon/llinstancetracker.h
index 403df08990..70bccde992 100644
--- a/indra/llcommon/llinstancetracker.h
+++ b/indra/llcommon/llinstancetracker.h
@@ -38,6 +38,31 @@
#include <boost/iterator/transform_iterator.hpp>
#include <boost/iterator/indirect_iterator.hpp>
+enum InstanceTrackType
+{
+ InstanceTrackType_LLEventAPI,
+ InstanceTrackType_LLEventTimer,
+ InstanceTrackType_NamedTimer,
+ InstanceTrackType_DeclareTimer,
+ InstanceTrackType_LLLeap,
+ InstanceTrackType_LLGLNamePool,
+ InstanceTrackType_LLConsole,
+ InstanceTrackType_LLFloater,
+ InstanceTrackType_LLFloaterWebContent,
+ InstanceTrackType_LLLayoutStack,
+ InstanceTrackType_LLNotificationContext,
+ InstanceTrackType_LLWindow,
+ InstanceTrackType_LLControlGroup,
+ InstanceTrackType_LLControlCache,
+ InstanceTrackType_LLMediaCtrl,
+ InstanceTrackType_LLNameListCtrl,
+ InstanceTrackType_LLToast,
+ kInstanceTrackTypeCount
+};
+
+#define INSTANCE_TRACKER(T) LLInstanceTracker< T, InstanceTrackType_##T >
+#define INSTANCE_TRACKER_KEYED(T,K) LLInstanceTracker< T, InstanceTrackType_##T, K >
+
/**
* Base class manages "class-static" data that must actually have singleton
* semantics: one instance per process, rather than one instance per module as
@@ -47,14 +72,15 @@ class LL_COMMON_API LLInstanceTrackerBase : public boost::noncopyable
{
protected:
/// Get a process-unique void* pointer slot for the specified type_info
- static void * & getInstances(std::type_info const & info);
+ //static void * & getInstances(std::type_info const & info);
+ static void * & getInstances(InstanceTrackType t);
/// Find or create a STATICDATA instance for the specified TRACKED class.
/// STATICDATA must be default-constructible.
- template<typename STATICDATA, class TRACKED>
+ template<typename STATICDATA, class TRACKED, class INST, InstanceTrackType TRACKEDTYPE>
static STATICDATA& getStatic()
{
- void *& instances = getInstances(typeid(TRACKED));
+ void *& instances = getInstances(TRACKEDTYPE);
if (! instances)
{
instances = new STATICDATA;
@@ -78,16 +104,16 @@ protected:
/// The (optional) key associates a value of type KEY with a given instance of T, for quick lookup
/// If KEY is not provided, then instances are stored in a simple set
/// @NOTE: see explicit specialization below for default KEY==T* case
-template<typename T, typename KEY = T*>
+template<typename T, enum InstanceTrackType TRACKED, typename KEY = T*>
class LLInstanceTracker : public LLInstanceTrackerBase
{
- typedef LLInstanceTracker<T, KEY> MyT;
+ typedef LLInstanceTracker<T, TRACKED, KEY> MyT;
typedef typename std::map<KEY, T*> InstanceMap;
struct StaticData: public StaticBase
{
InstanceMap sMap;
};
- static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT>(); }
+ static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT, T, TRACKED>(); }
static InstanceMap& getMap_() { return getStatic().sMap; }
public:
@@ -226,16 +252,16 @@ private:
/// explicit specialization for default case where KEY is T*
/// use a simple std::set<T*>
-template<typename T>
-class LLInstanceTracker<T, T*> : public LLInstanceTrackerBase
+template<typename T, enum InstanceTrackType TRACKED>
+class LLInstanceTracker<T, TRACKED, T*> : public LLInstanceTrackerBase
{
- typedef LLInstanceTracker<T, T*> MyT;
+ typedef LLInstanceTracker<T, TRACKED, T*> MyT;
typedef typename std::set<T*> InstanceSet;
struct StaticData: public StaticBase
{
InstanceSet sSet;
};
- static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT>(); }
+ static StaticData& getStatic() { return LLInstanceTrackerBase::getStatic<StaticData, MyT, T, TRACKED>(); }
static InstanceSet& getSet_() { return getStatic().sSet; }
public:
diff --git a/indra/llcommon/llleap.h b/indra/llcommon/llleap.h
index 1a1ad23d39..d4e138f4be 100644
--- a/indra/llcommon/llleap.h
+++ b/indra/llcommon/llleap.h
@@ -29,9 +29,10 @@
* LLLeap* pointer should be validated before use by
* LLLeap::getInstance(LLLeap*) (see LLInstanceTracker).
*/
-class LL_COMMON_API LLLeap: public LLInstanceTracker<LLLeap>
+class LL_COMMON_API LLLeap: public INSTANCE_TRACKER(LLLeap)
{
public:
+
/**
* Pass a brief string description, mostly for logging purposes. The desc
* need not be unique, but obviously the clearer we can make it, the
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 823de9d361..133c2de1f5 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -350,10 +350,10 @@ public:
Generic pooling scheme for things which use GL names (used for occlusion queries and vertex buffer objects).
Prevents thrashing of GL name caches by avoiding calls to glGenFoo and glDeleteFoo.
*/
-class LLGLNamePool : public LLInstanceTracker<LLGLNamePool>
+class LLGLNamePool : public INSTANCE_TRACKER(LLGLNamePool)
{
public:
- typedef LLInstanceTracker<LLGLNamePool> tracker_t;
+ typedef INSTANCE_TRACKER(LLGLNamePool) tracker_t;
struct NameEntry
{
diff --git a/indra/llui/llconsole.h b/indra/llui/llconsole.h
index f32f1dd74c..b264aeb7eb 100644
--- a/indra/llui/llconsole.h
+++ b/indra/llui/llconsole.h
@@ -34,9 +34,10 @@
class LLSD;
-class LLConsole : public LLFixedBuffer, public LLUICtrl, public LLInstanceTracker<LLConsole>
+class LLConsole : public LLFixedBuffer, public LLUICtrl, public INSTANCE_TRACKER(LLConsole)
{
public:
+
typedef enum e_font_size
{
MONOSPACE = -1,
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index aef63bcf93..113fdf10e4 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -112,15 +112,18 @@ struct LLCoordFloater : LLCoord<LL_COORD_FLOATER>
bool operator!=(const LLCoordFloater& other) const { return !(*this == other); }
void setFloater(LLFloater& floater);
+
+
};
-class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
+class LLFloater : public LLPanel, public INSTANCE_TRACKER(LLFloater)
{
friend class LLFloaterView;
friend class LLFloaterReg;
friend class LLMultiFloater;
public:
+
struct KeyCompare
{
// static bool compare(const LLSD& a, const LLSD& b);
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 648cd5fdce..26b8a7f973 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -34,9 +34,10 @@
class LLLayoutPanel;
-class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
+class LLLayoutStack : public LLView, public INSTANCE_TRACKER(LLLayoutStack)
{
public:
+
typedef enum e_layout_orientation
{
HORIZONTAL,
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index d7534c416d..faeba8f6eb 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -136,10 +136,11 @@ typedef LLFunctorRegistration<LLNotificationResponder> LLNotificationFunctorRegi
// context data that can be looked up via a notification's payload by the display logic
// derive from this class to implement specific contexts
-class LLNotificationContext : public LLInstanceTracker<LLNotificationContext, LLUUID>
+class LLNotificationContext : public INSTANCE_TRACKER_KEYED(LLNotificationContext, LLUUID)
{
public:
- LLNotificationContext() : LLInstanceTracker<LLNotificationContext, LLUUID>(LLUUID::generateNewID())
+
+ LLNotificationContext() : INSTANCE_TRACKER_KEYED(LLNotificationContext, LLUUID)(LLUUID::generateNewID())
{
}
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index e9147d552e..06d7e4907a 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -39,9 +39,10 @@ class LLWindowCallbacks;
// Refer to llwindow_test in test/common/llwindow for usage example
-class LLWindow : public LLInstanceTracker<LLWindow>
+class LLWindow : public INSTANCE_TRACKER(LLWindow)
{
public:
+
struct LLWindowResolution
{
S32 mWidth;
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 53d9380f4f..561f4fdc73 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -316,7 +316,7 @@ LLPointer<LLControlVariable> LLControlGroup::getControl(const std::string& name)
////////////////////////////////////////////////////////////////////////////
LLControlGroup::LLControlGroup(const std::string& name)
-: LLInstanceTracker<LLControlGroup, std::string>(name)
+: INSTANCE_TRACKER_KEYED(LLControlGroup, std::string)(name)
{
mTypeString[TYPE_U32] = "U32";
mTypeString[TYPE_S32] = "S32";
diff --git a/indra/llxml/llcontrol.h b/indra/llxml/llcontrol.h
index ee7d1d50b7..6ea010f4f9 100644
--- a/indra/llxml/llcontrol.h
+++ b/indra/llxml/llcontrol.h
@@ -180,7 +180,7 @@ T convert_from_llsd(const LLSD& sd, eControlType type, const std::string& contro
}
//const U32 STRING_CACHE_SIZE = 10000;
-class LLControlGroup : public LLInstanceTracker<LLControlGroup, std::string>
+class LLControlGroup : public INSTANCE_TRACKER_KEYED(LLControlGroup, std::string)
{
LOG_CLASS(LLControlGroup);
@@ -197,7 +197,7 @@ public:
~LLControlGroup();
void cleanup();
- typedef LLInstanceTracker<LLControlGroup, std::string>::instance_iter instance_iter;
+ typedef INSTANCE_TRACKER_KEYED(LLControlGroup, std::string)::instance_iter instance_iter;
LLControlVariablePtr getControl(const std::string& name);
@@ -306,7 +306,7 @@ public:
//! without have to manually create and bind a listener to a local
//! object.
template <class T>
-class LLControlCache : public LLRefCount, public LLInstanceTracker<LLControlCache<T>, std::string>
+class LLControlCache : public LLRefCount, public LLInstanceTracker<LLControlCache<T>, InstanceTrackType_LLControlCache, std::string>
{
public:
// This constructor will declare a control if it doesn't exist in the contol group
@@ -314,7 +314,7 @@ public:
const std::string& name,
const T& default_value,
const std::string& comment)
- : LLInstanceTracker<LLControlCache<T>, std::string >(name)
+ : LLInstanceTracker<LLControlCache<T>, InstanceTrackType_LLControlCache, std::string >(name)
{
if(!group.controlExists(name))
{
@@ -329,7 +329,7 @@ public:
LLControlCache(LLControlGroup& group,
const std::string& name)
- : LLInstanceTracker<LLControlCache<T>, std::string >(name)
+ : LLInstanceTracker<LLControlCache<T>, InstanceTrackType_LLControlCache, std::string >(name)
{
if(!group.controlExists(name))
{
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index d041baea90..119b8d24d0 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -577,6 +577,12 @@ F32 LLDrawable::updateXform(BOOL undamped)
mVObjp->dirtySpatialGroup();
}
}
+ else if (!isRoot()
+ && ( dist_vec_squared(old_pos, target_pos) > 0.f
+ || (1.f - dot(old_rot, target_rot)) > 0.f))
+ { // update child prims moved from LSL
+ gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
+ }
else if (!getVOVolume() && !isAvatar())
{
movePartition();
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 3fe2518de6..94c3f4149c 100644
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -54,7 +54,7 @@ LLFloaterWebContent::_Params::_Params()
LLFloaterWebContent::LLFloaterWebContent( const Params& params )
: LLFloater( params ),
- LLInstanceTracker<LLFloaterWebContent, std::string>(params.id()),
+ INSTANCE_TRACKER_KEYED(LLFloaterWebContent, std::string)(params.id()),
mWebBrowser(NULL),
mAddressCombo(NULL),
mSecureLockIcon(NULL),
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index cfc87e9015..409c15fb0b 100644
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -40,10 +40,11 @@ class LLIconCtrl;
class LLFloaterWebContent :
public LLFloater,
public LLViewerMediaObserver,
- public LLInstanceTracker<LLFloaterWebContent, std::string>
+ public INSTANCE_TRACKER_KEYED(LLFloaterWebContent, std::string)
{
public:
- typedef LLInstanceTracker<LLFloaterWebContent, std::string> instance_tracker_t;
+
+ typedef INSTANCE_TRACKER_KEYED(LLFloaterWebContent, std::string) instance_tracker_t;
LOG_CLASS(LLFloaterWebContent);
struct _Params : public LLInitParam::Block<_Params>
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 99b4707158..48730f0f20 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -81,7 +81,7 @@ LLMediaCtrl::Params::Params()
LLMediaCtrl::LLMediaCtrl( const Params& p) :
LLPanel( p ),
- LLInstanceTracker<LLMediaCtrl, LLUUID>(LLUUID::generateNewID()),
+ INSTANCE_TRACKER_KEYED(LLMediaCtrl, LLUUID)(LLUUID::generateNewID()),
mTextureDepthBytes( 4 ),
mBorder(NULL),
mFrequentUpdates( true ),
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 7f2a5e1642..4fed21bf22 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -42,10 +42,11 @@ class LLMediaCtrl :
public LLPanel,
public LLViewerMediaObserver,
public LLViewerMediaEventEmitter,
- public LLInstanceTracker<LLMediaCtrl, LLUUID>
+ public INSTANCE_TRACKER_KEYED(LLMediaCtrl, LLUUID)
{
LOG_CLASS(LLMediaCtrl);
public:
+
struct Params : public LLInitParam::Block<Params, LLPanel::Params>
{
Optional<std::string> start_url;
diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h
index 09c3d49fe7..103806a1bd 100644
--- a/indra/newview/llnamelistctrl.h
+++ b/indra/newview/llnamelistctrl.h
@@ -64,9 +64,10 @@ private:
class LLNameListCtrl
-: public LLScrollListCtrl, public LLInstanceTracker<LLNameListCtrl>
+: public LLScrollListCtrl, public INSTANCE_TRACKER(LLNameListCtrl)
{
public:
+
typedef enum e_name_type
{
INDIVIDUAL,
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 9dfb29b905..49debe67f6 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -572,7 +572,7 @@ S32 LLToast::notifyParent(const LLSD& info)
//static
void LLToast::updateClass()
{
- for (LLInstanceTracker<LLToast>::instance_iter iter = LLInstanceTracker<LLToast>::beginInstances(); iter != LLInstanceTracker<LLToast>::endInstances(); )
+ for (INSTANCE_TRACKER(LLToast)::instance_iter iter = INSTANCE_TRACKER(LLToast)::beginInstances(); iter != INSTANCE_TRACKER(LLToast)::endInstances(); )
{
LLToast& toast = *iter++;
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index e1d99b1bcb..8f77e7b78b 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -69,10 +69,11 @@ private :
* Represents toast pop-up.
* This is a parent view for all toast panels.
*/
-class LLToast : public LLModalDialog, public LLInstanceTracker<LLToast>
+class LLToast : public LLModalDialog, public INSTANCE_TRACKER(LLToast)
{
friend class LLToastLifeTimer;
public:
+
typedef boost::function<void (LLToast* toast)> toast_callback_t;
typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
typedef boost::signals2::signal<void (LLToast* toast, bool mouse_enter)> toast_hover_check_signal_t;