summaryrefslogtreecommitdiff
path: root/indra/llmath/llvolumemgr.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmath/llvolumemgr.h')
-rw-r--r--indra/llmath/llvolumemgr.h47
1 files changed, 36 insertions, 11 deletions
diff --git a/indra/llmath/llvolumemgr.h b/indra/llmath/llvolumemgr.h
index f3d4b5ee6b..c28ffce631 100644
--- a/indra/llmath/llvolumemgr.h
+++ b/indra/llmath/llvolumemgr.h
@@ -43,9 +43,6 @@ class LLVolumeLODGroup;
class LLVolumeLODGroup : public LLThreadSafeRefCount
{
-protected:
- ~LLVolumeLODGroup();
-
public:
enum
{
@@ -60,11 +57,19 @@ public:
static F32 getVolumeScaleFromDetail(const S32 detail);
LLVolume *getLOD(const S32 detail);
- const LLVolumeParams &getParams() const { return mParams; };
+ const LLVolumeParams& getParams() const { return mParams; };
F32 dump();
friend std::ostream& operator<<(std::ostream& s, const LLVolumeLODGroup& volgroup);
+#ifdef DEBUG_VOLUME
+ S32 getTotalVolumeRefCount() const;
+#endif
+
+protected:
+ virtual ~LLVolumeLODGroup();
+ void destroy();
+
protected:
LLVolumeParams mParams;
@@ -77,30 +82,50 @@ protected:
class LLVolumeMgr
{
-public:
- static void initClass();
- static BOOL cleanupClass();
+//public:
+// static void initClass();
+// static BOOL cleanupClass();
public:
LLVolumeMgr();
- ~LLVolumeMgr();
+ virtual ~LLVolumeMgr();
BOOL cleanup(); // Cleanup all volumes being managed, returns TRUE if no dangling references
+
+ virtual LLVolumeLODGroup* getGroup( const LLVolumeParams& volume_params ) const;
+
+ // whatever calls getVolume() never owns the LLVolume* and
+ // cannot keep references for long since it may be deleted
+ // later. For best results hold it in an LLPointer<LLVolume>.
LLVolume *getVolume(const LLVolumeParams &volume_params, const S32 detail);
+
void cleanupVolume(LLVolume *volumep);
void dump();
+
+ // manually call this for mutex magic
+ void useMutex();
+
+#ifdef DEBUG_VOLUME
+ S32 getTotalRefCount() const;
+ S32 getGroupCount() const;
+#endif
friend std::ostream& operator<<(std::ostream& s, const LLVolumeMgr& volume_mgr);
protected:
+ virtual LLVolumeLODGroup* createNewGroup(const LLVolumeParams& volume_params);
+
+protected:
typedef std::map<const LLVolumeParams*, LLVolumeLODGroup*, LLVolumeParams::compare> volume_lod_group_map_t;
typedef volume_lod_group_map_t::const_iterator volume_lod_group_map_iter;
volume_lod_group_map_t mVolumeLODGroups;
LLMutex* mDataMutex;
-
-// S32 mNumVolumes;
+
+ // We need to be able to disable threadsafe checks to prevent
+ // some unit_tests from blocking on failure
+ bool mThreadSafe;
};
-extern LLVolumeMgr* gVolumeMgr;
+//extern LLVolumeMgr* gVolumeMgr;
#endif // LL_LLVOLUMEMGR_H