diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp
index 8ab7f5bcea..31b90f6b5e 100644
--- a/indra/llcommon/llapr.cpp
+++ b/indra/llcommon/llapr.cpp
@@ -31,7 +31,13 @@
#include "apr_dso.h"
apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool
-LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
+
+// Not thread safe
+
+// LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool.
+
+//
+
apr_thread_mutex_t *gLogMutexp = NULL;
apr_thread_mutex_t *gCallStacksLogMutexp = NULL;
@@ -52,10 +58,11 @@ void ll_init_apr()
apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp);
}
- if(!LLAPRFile::sAPRFilePoolp)
- {
- LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ;
- }
+ //
+ // if(!LLAPRFile::sAPRFilePoolp)
+ // {
+ // LLAPRFile::sAPRFilePoolp = new LLVolatileAPRPool(FALSE) ;
+ // }
}
@@ -84,11 +91,12 @@ void ll_cleanup_apr()
apr_pool_destroy(gAPRPoolp);
gAPRPoolp = NULL;
}
- if (LLAPRFile::sAPRFilePoolp)
- {
- delete LLAPRFile::sAPRFilePoolp ;
- LLAPRFile::sAPRFilePoolp = NULL ;
- }
+ // if (LLAPRFile::sAPRFilePoolp)
+ // {
+ // delete LLAPRFile::sAPRFilePoolp ;
+ // LLAPRFile::sAPRFilePoolp = NULL ;
+ // }
+
apr_terminate();
}
@@ -150,103 +158,108 @@ apr_pool_t* LLAPRPool::getAPRPool()
return mPool ;
}
-LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
- : LLAPRPool(parent, size, releasePoolFlag),
- mNumActiveRef(0),
- mNumTotalRef(0),
- mMutexPool(NULL),
- mMutexp(NULL)
-{
- //create mutex
+// Not thread safe
- // Crashfix/FIRE-4090/FIRE-4820: is_local is default to TRUE. And of today (2012-07-15) all instances of LLVolatileAPRPool seem
- // to be created just using this default argument.
- // Using apr_os_thread_current and apr_os_thread_equal it appears that there are pools that get access from different threads nonetheless.
- // This would explain why mNumActiveRef sometimes gets garbled.
- // Resolution: Always use a mutex and give it a broader test is this helps.
+// LLVolatileAPRPool::LLVolatileAPRPool(BOOL is_local, apr_pool_t *parent, apr_size_t size, BOOL releasePoolFlag)
+// : LLAPRPool(parent, size, releasePoolFlag),
+// mNumActiveRef(0),
+// mNumTotalRef(0),
+// mMutexPool(NULL),
+// mMutexp(NULL)
+// {
+// //create mutex
+//
+// // Crashfix/FIRE-4090/FIRE-4820: is_local is default to TRUE. And of today (2012-07-15) all instances of LLVolatileAPRPool seem
+// // to be created just using this default argument.
+// // Using apr_os_thread_current and apr_os_thread_equal it appears that there are pools that get access from different threads nonetheless.
+// // This would explain why mNumActiveRef sometimes gets garbled.
+// // Resolution: Always use a mutex and give it a broader test is this helps.
+//
+// // if(!is_local) //not a local apr_pool, that is: shared by multiple threads.
+//
+// //
+//
+// {
+// apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex
+// apr_thread_mutex_create(&mMutexp, APR_THREAD_MUTEX_UNNESTED, mMutexPool);
+// }
+// }
+//
+// LLVolatileAPRPool::~LLVolatileAPRPool()
+// {
+// //delete mutex
+// if(mMutexp)
+// {
+// apr_thread_mutex_destroy(mMutexp);
+// apr_pool_destroy(mMutexPool);
+// }
+// }
+//
+// //
+// //define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool().
+// //
+// //virtual
+// apr_pool_t* LLVolatileAPRPool::getAPRPool()
+// {
+// return LLVolatileAPRPool::getVolatileAPRPool() ;
+// }
+//
+// apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool()
+// {
+// LLScopedLock lock(mMutexp) ;
+//
+// mNumTotalRef++ ;
+// mNumActiveRef++ ;
+//
+// if(!mPool)
+// {
+// createAPRPool() ;
+// }
+//
+// return mPool ;
+// }
+//
+// void LLVolatileAPRPool::clearVolatileAPRPool()
+// {
+// LLScopedLock lock(mMutexp) ;
+//
+// if(mNumActiveRef > 0)
+// {
+// mNumActiveRef--;
+// if(mNumActiveRef < 1)
+// {
+// if(isFull())
+// {
+// mNumTotalRef = 0 ;
+//
+// //destroy the apr_pool.
+// releaseAPRPool() ;
+// }
+// else
+// {
+// //This does not actually free the memory,
+// //it just allows the pool to re-use this memory for the next allocation.
+// apr_pool_clear(mPool) ;
+// }
+// }
+// }
+// else
+// {
+// llassert_always(mNumActiveRef > 0) ;
+// }
+//
+// //paranoia check if the pool is jammed.
+// //will remove the check before going to release.
+// llassert_always(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ;
+// }
+//
+// BOOL LLVolatileAPRPool::isFull()
+// {
+// return mNumTotalRef > FULL_VOLATILE_APR_POOL ;
+// }
- // if(!is_local) //not a local apr_pool, that is: shared by multiple threads.
+//
- //
-
- {
- apr_pool_create(&mMutexPool, NULL); // Create a pool for mutex
- apr_thread_mutex_create(&mMutexp, APR_THREAD_MUTEX_UNNESTED, mMutexPool);
- }
-}
-
-LLVolatileAPRPool::~LLVolatileAPRPool()
-{
- //delete mutex
- if(mMutexp)
- {
- apr_thread_mutex_destroy(mMutexp);
- apr_pool_destroy(mMutexPool);
- }
-}
-
-//
-//define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool().
-//
-//virtual
-apr_pool_t* LLVolatileAPRPool::getAPRPool()
-{
- return LLVolatileAPRPool::getVolatileAPRPool() ;
-}
-
-apr_pool_t* LLVolatileAPRPool::getVolatileAPRPool()
-{
- LLScopedLock lock(mMutexp) ;
-
- mNumTotalRef++ ;
- mNumActiveRef++ ;
-
- if(!mPool)
- {
- createAPRPool() ;
- }
-
- return mPool ;
-}
-
-void LLVolatileAPRPool::clearVolatileAPRPool()
-{
- LLScopedLock lock(mMutexp) ;
-
- if(mNumActiveRef > 0)
- {
- mNumActiveRef--;
- if(mNumActiveRef < 1)
- {
- if(isFull())
- {
- mNumTotalRef = 0 ;
-
- //destroy the apr_pool.
- releaseAPRPool() ;
- }
- else
- {
- //This does not actually free the memory,
- //it just allows the pool to re-use this memory for the next allocation.
- apr_pool_clear(mPool) ;
- }
- }
- }
- else
- {
- llassert_always(mNumActiveRef > 0) ;
- }
-
- //paranoia check if the pool is jammed.
- //will remove the check before going to release.
- llassert_always(mNumTotalRef < (FULL_VOLATILE_APR_POOL << 2)) ;
-}
-
-BOOL LLVolatileAPRPool::isFull()
-{
- return mNumTotalRef > FULL_VOLATILE_APR_POOL ;
-}
//---------------------------------------------------------------------
//
// LLScopedLock
@@ -324,14 +337,14 @@ void ll_apr_assert_status(apr_status_t status, apr_dso_handle_t *handle)
// LLAPRFile functions
//
LLAPRFile::LLAPRFile()
- : mFile(NULL),
- mCurrentFilePoolp(NULL)
+ : mFile(NULL)
+ // mCurrentFilePoolp(NULL)
{
}
LLAPRFile::LLAPRFile(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool)
- : mFile(NULL),
- mCurrentFilePoolp(NULL)
+ : mFile(NULL)
+ // mCurrentFilePoolp(NULL)
{
open(filename, flags, pool);
}
@@ -350,11 +363,11 @@ apr_status_t LLAPRFile::close()
mFile = NULL ;
}
- if(mCurrentFilePoolp)
- {
- mCurrentFilePoolp->clearVolatileAPRPool() ;
- mCurrentFilePoolp = NULL ;
- }
+ // if(mCurrentFilePoolp)
+ // {
+ // mCurrentFilePoolp->clearVolatileAPRPool() ;
+ // mCurrentFilePoolp = NULL ;
+ // }
return ret ;
}
@@ -365,9 +378,10 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLV
//check if already open some file
llassert_always(!mFile) ;
- llassert_always(!mCurrentFilePoolp) ;
+ // llassert_always(!mCurrentFilePoolp) ;
- apr_pool_t* apr_pool = pool ? pool->getVolatileAPRPool() : NULL ;
+ // apr_pool_t* apr_pool = pool ? pool->getVolatileAPRPool() : NULL ;
+ apr_pool_t* apr_pool(0);
// Convert filenames with UTF-8 charaters into a shortfilename (8.3) if running under windows
@@ -399,9 +413,9 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLV
*sizep = file_size;
}
- if(!mCurrentFilePoolp)
+ // if(!mCurrentFilePoolp)
{
- mCurrentFilePoolp = pool ;
+ // mCurrentFilePoolp = pool ;
if(!mFile)
{
@@ -419,10 +433,11 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, BOO
//check if already open some file
llassert_always(!mFile) ;
- llassert_always(!mCurrentFilePoolp) ;
- llassert_always(use_global_pool) ; //be aware of using gAPRPoolp.
+ // llassert_always(!mCurrentFilePoolp) ;
+ // llassert_always(use_global_pool) ; //be aware of using gAPRPoolp.
- s = apr_file_open(&mFile, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, gAPRPoolp);
+ // s = apr_file_open(&mFile, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, gAPRPoolp);
+ s = apr_file_open(&mFile, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, m_Pool.getAPRPool());
if (s != APR_SUCCESS || !mFile)
{
mFile = NULL ;
@@ -435,13 +450,15 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, BOO
apr_pool_t* LLAPRFile::getAPRFilePool(apr_pool_t* pool)
{
- if(!pool)
- {
- mCurrentFilePoolp = sAPRFilePoolp ;
- return mCurrentFilePoolp->getVolatileAPRPool() ;
- }
+ // if(!pool)
+ // {
+ // mCurrentFilePoolp = sAPRFilePoolp ;
+ // return mCurrentFilePoolp->getVolatileAPRPool() ;
+ // }
+ //
+ // return pool ;
- return pool ;
+ return m_Pool.getAPRPool();
}
// File I/O
@@ -500,7 +517,8 @@ S32 LLAPRFile::seek(apr_seek_where_t where, S32 offset)
//
//static
-apr_status_t LLAPRFile::close(apr_file_t* file_handle, LLVolatileAPRPool* pool)
+// apr_status_t LLAPRFile::close(apr_file_t* file_handle, LLVolatileAPRPool* pool)
+apr_status_t LLAPRFile::close(apr_file_t* file_handle, LLAPRPool* pool)
{
apr_status_t ret = APR_SUCCESS ;
if(file_handle)
@@ -509,23 +527,26 @@ apr_status_t LLAPRFile::close(apr_file_t* file_handle, LLVolatileAPRPool* pool)
file_handle = NULL ;
}
- if(pool)
- {
- pool->clearVolatileAPRPool() ;
- }
+ // if(pool)
+ // {
+ // pool->clearVolatileAPRPool() ;
+ // }
return ret ;
}
//static
-apr_file_t* LLAPRFile::open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags)
+// apr_file_t* LLAPRFile::open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags)
+apr_file_t* LLAPRFile::open(const std::string& filename, LLAPRPool* pool, apr_int32_t flags)
{
apr_status_t s;
apr_file_t* file_handle ;
- pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // s = apr_file_open(&file_handle, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool());
+
+ s = apr_file_open(&file_handle, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, pool->getAPRPool() );
- s = apr_file_open(&file_handle, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool());
if (s != APR_SUCCESS || !file_handle)
{
ll_apr_warn_status(s);
@@ -574,7 +595,10 @@ S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset)
S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool)
{
//*****************************************
- apr_file_t* file_handle = open(filename, pool, APR_READ|APR_BINARY);
+ // apr_file_t* file_handle = open(filename, pool, APR_READ|APR_BINARY);
+
+ LLAPRPool oPool;
+ apr_file_t* file_handle = open(filename, &oPool, APR_READ|APR_BINARY);
//*****************************************
if (!file_handle)
{
@@ -608,7 +632,8 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb
}
//*****************************************
- close(file_handle, pool) ;
+ // close(file_handle, pool) ;
+ close(file_handle, &oPool) ;
//*****************************************
return (S32)bytes_read;
}
@@ -624,7 +649,10 @@ S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 n
}
//*****************************************
- apr_file_t* file_handle = open(filename, pool, flags);
+ // apr_file_t* file_handle = open(filename, pool, flags);
+
+ LLAPRPool oPool;
+ apr_file_t* file_handle = open(filename, &oPool, flags);
//*****************************************
if (!file_handle)
{
@@ -658,7 +686,8 @@ S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 n
}
//*****************************************
- LLAPRFile::close(file_handle, pool);
+ // LLAPRFile::close(file_handle, pool);
+ LLAPRFile::close(file_handle, &oPool);
//*****************************************
return (S32)bytes_written;
@@ -669,9 +698,12 @@ bool LLAPRFile::remove(const std::string& filename, LLVolatileAPRPool* pool)
{
apr_status_t s;
- pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
- s = apr_file_remove(filename.c_str(), pool->getVolatileAPRPool());
- pool->clearVolatileAPRPool() ;
+ // pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // s = apr_file_remove(filename.c_str(), pool->getVolatileAPRPool());
+ // pool->clearVolatileAPRPool() ;
+
+ LLAPRPool oPool;
+ s = apr_file_remove(filename.c_str(), oPool.getAPRPool());
if (s != APR_SUCCESS)
{
@@ -692,9 +724,12 @@ bool LLAPRFile::rename(const std::string& filename, const std::string& newname,
{
apr_status_t s;
- pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
- s = apr_file_rename(filename.c_str(), newname.c_str(), pool->getVolatileAPRPool());
- pool->clearVolatileAPRPool() ;
+ // pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // s = apr_file_rename(filename.c_str(), newname.c_str(), pool->getVolatileAPRPool());
+ // pool->clearVolatileAPRPool() ;
+
+ LLAPRPool oPool;
+ s = apr_file_rename(filename.c_str(), newname.c_str(), oPool.getAPRPool() );
if (s != APR_SUCCESS)
{
@@ -711,18 +746,21 @@ bool LLAPRFile::isExist(const std::string& filename, LLVolatileAPRPool* pool, ap
apr_file_t* apr_file;
apr_status_t s;
- pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
- s = apr_file_open(&apr_file, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool());
+ // pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // s = apr_file_open(&apr_file, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, pool->getVolatileAPRPool());
+
+ LLAPRPool oPool;
+ s = apr_file_open(&apr_file, ndConvertFilename(filename).c_str(), flags, APR_OS_DEFAULT, oPool.getAPRPool() );
if (s != APR_SUCCESS || !apr_file)
{
- pool->clearVolatileAPRPool() ;
+ // pool->clearVolatileAPRPool() ;
return false;
}
else
{
apr_file_close(apr_file) ;
- pool->clearVolatileAPRPool() ;
+ // pool->clearVolatileAPRPool() ;
return true;
}
}
@@ -734,12 +772,15 @@ S32 LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool)
apr_finfo_t info;
apr_status_t s;
- pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
- s = apr_file_open(&apr_file, ndConvertFilename(filename).c_str(), APR_READ, APR_OS_DEFAULT, pool->getVolatileAPRPool());
+ // pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // s = apr_file_open(&apr_file, ndConvertFilename(filename).c_str(), APR_READ, APR_OS_DEFAULT, pool->getVolatileAPRPool());
+
+ LLAPRPool oPool;
+ s = apr_file_open(&apr_file, ndConvertFilename(filename).c_str(), APR_READ, APR_OS_DEFAULT, oPool.getAPRPool() );
if (s != APR_SUCCESS || !apr_file)
{
- pool->clearVolatileAPRPool() ;
+ // pool->clearVolatileAPRPool() ;
return 0;
}
@@ -748,7 +789,7 @@ S32 LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool)
apr_status_t s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file);
apr_file_close(apr_file) ;
- pool->clearVolatileAPRPool() ;
+ // pool->clearVolatileAPRPool() ;
if (s == APR_SUCCESS)
{
@@ -766,10 +807,13 @@ bool LLAPRFile::makeDir(const std::string& dirname, LLVolatileAPRPool* pool)
{
apr_status_t s;
- pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
- s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool->getVolatileAPRPool());
- pool->clearVolatileAPRPool() ;
-
+ // pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, pool->getVolatileAPRPool());
+ // pool->clearVolatileAPRPool() ;
+
+ LLAPRPool oPool;
+ s = apr_dir_make(dirname.c_str(), APR_FPROT_OS_DEFAULT, oPool.getAPRPool() );
+
if (s != APR_SUCCESS)
{
ll_apr_warn_status(s);
@@ -784,9 +828,12 @@ bool LLAPRFile::removeDir(const std::string& dirname, LLVolatileAPRPool* pool)
{
apr_status_t s;
- pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
- s = apr_file_remove(dirname.c_str(), pool->getVolatileAPRPool());
- pool->clearVolatileAPRPool() ;
+ // pool = pool ? pool : LLAPRFile::sAPRFilePoolp ;
+ // s = apr_file_remove(dirname.c_str(), pool->getVolatileAPRPool());
+ // pool->clearVolatileAPRPool() ;
+
+ LLAPRPool oPool;
+ s = apr_file_remove(dirname.c_str(), oPool.getAPRPool() );
if (s != APR_SUCCESS)
{
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index af33ce666f..f733eecc18 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -96,25 +96,32 @@ protected:
//which clears memory automatically.
//so it can not hold static data or data after memory is cleared
//
-class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool
-{
-public:
- LLVolatileAPRPool(BOOL is_local = TRUE, apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE);
- virtual ~LLVolatileAPRPool();
- /*virtual*/ apr_pool_t* getAPRPool() ; //define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool().
- apr_pool_t* getVolatileAPRPool() ;
- void clearVolatileAPRPool() ;
+// Not thread safe
- BOOL isFull() ;
-
-private:
- S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool.
- S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating.
+// class LL_COMMON_API LLVolatileAPRPool : public LLAPRPool
+// {
+// public:
+// LLVolatileAPRPool(BOOL is_local = TRUE, apr_pool_t *parent = NULL, apr_size_t size = 0, BOOL releasePoolFlag = TRUE);
+// virtual ~LLVolatileAPRPool();
+//
+// /*virtual*/ apr_pool_t* getAPRPool() ; //define this virtual function to avoid any mistakenly calling LLAPRPool::getAPRPool().
+// apr_pool_t* getVolatileAPRPool() ;
+// void clearVolatileAPRPool() ;
+//
+// BOOL isFull() ;
+//
+// private:
+// S32 mNumActiveRef ; //number of active pointers pointing to the apr_pool.
+// S32 mNumTotalRef ; //number of total pointers pointing to the apr_pool since last creating.
+//
+// apr_thread_mutex_t *mMutexp;
+// apr_pool_t *mMutexPool;
+// } ;
- apr_thread_mutex_t *mMutexp;
- apr_pool_t *mMutexPool;
-} ;
+typedef void LLVolatileAPRPool;
+
+//
/**
* @class LLScopedLock
@@ -205,7 +212,8 @@ class LL_COMMON_API LLAPRFile : boost::noncopyable
// make this non copyable since a copy closes the file
private:
apr_file_t* mFile ;
- LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool.
+ LLAPRPool m_Pool;
+ // LLVolatileAPRPool *mCurrentFilePoolp ; //currently in use apr_pool, could be one of them: sAPRFilePoolp, or a temp pool.
public:
LLAPRFile() ;
@@ -234,11 +242,13 @@ private:
//static components
//
public:
- static LLVolatileAPRPool *sAPRFilePoolp ; //a global apr_pool for APRFile, which is used only when local pool does not exist.
+ // static LLVolatileAPRPool *sAPRFilePoolp ; //a global apr_pool for APRFile, which is used only when local pool does not exist.
private:
- static apr_file_t* open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags);
- static apr_status_t close(apr_file_t* file, LLVolatileAPRPool* pool) ;
+ // static apr_file_t* open(const std::string& filename, LLVolatileAPRPool* pool, apr_int32_t flags);
+ // static apr_status_t close(apr_file_t* file, LLVolatileAPRPool* pool) ;
+ static apr_file_t* open(const std::string& filename, LLAPRPool* pool, apr_int32_t flags);
+ static apr_status_t close(apr_file_t* file, LLAPRPool* pool) ;
static S32 seek(apr_file_t* file, apr_seek_where_t where, S32 offset);
public:
// returns false if failure:
@@ -267,6 +277,9 @@ bool LL_COMMON_API ll_apr_warn_status(apr_status_t status, apr_dso_handle_t* han
void LL_COMMON_API ll_apr_assert_status(apr_status_t status);
void LL_COMMON_API ll_apr_assert_status(apr_status_t status, apr_dso_handle_t* handle);
+// Not thread safe at all, but must do for now
extern "C" LL_COMMON_API apr_pool_t* gAPRPoolp; // Global APR memory pool
+//
+
#endif // LL_LLAPR_H
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp
index 66c31624cd..a31f09c185 100644
--- a/indra/llcommon/llthread.cpp
+++ b/indra/llcommon/llthread.cpp
@@ -115,7 +115,11 @@ LLThread::LLThread(const std::string& name, apr_pool_t *poolp) :
}
mRunCondition = new LLCondition(mAPRPoolp);
- mLocalAPRFilePoolp = NULL ;
+ // Removed LLVolatileAPRPool
+
+ // mLocalAPRFilePoolp = NULL ;
+
+ //
}
@@ -123,11 +127,15 @@ LLThread::~LLThread()
{
shutdown();
- if(mLocalAPRFilePoolp)
- {
- delete mLocalAPRFilePoolp ;
- mLocalAPRFilePoolp = NULL ;
- }
+ // Removed LLVolatileAPRPool
+
+ // if(mLocalAPRFilePoolp)
+ // {
+ // delete mLocalAPRFilePoolp ;
+ // mLocalAPRFilePoolp = NULL ;
+ // }
+
+ //
}
void LLThread::shutdown()
@@ -175,7 +183,10 @@ void LLThread::shutdown()
delete mRunCondition;
mRunCondition = 0;
- if (mIsLocalPool && mAPRPoolp)
+ // Removed LLVolatileAPRPool
+ // if (mIsLocalPool && mAPRPoolp)
+ if ( mAPRPoolp)
+ //
{
apr_pool_destroy(mAPRPoolp);
mAPRPoolp = 0;
diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h
index b52e70ab2e..dcea03badd 100644
--- a/indra/llcommon/llthread.h
+++ b/indra/llcommon/llthread.h
@@ -84,8 +84,11 @@ public:
void start(void);
apr_pool_t *getAPRPool() { return mAPRPoolp; }
- LLVolatileAPRPool* getLocalAPRFilePool() { return mLocalAPRFilePoolp ; }
+ // Removed LLVolatileAPRPool
+ // LLVolatileAPRPool* getLocalAPRFilePool() { return mLocalAPRFilePoolp ; }
+ //
+
U32 getID() const { return mID; }
private:
@@ -107,7 +110,10 @@ protected:
//a local apr_pool for APRFile operations in this thread. If it exists, LLAPRFile::sAPRFilePoolp should not be used.
//Note: this pool is used by APRFile ONLY, do NOT use it for any other purposes.
// otherwise it will cause severe memory leaking!!! --bao
- LLVolatileAPRPool *mLocalAPRFilePoolp ;
+
+ // Removed LLVolatileAPRPool
+ // LLVolatileAPRPool *mLocalAPRFilePoolp ;
+ //
void setQuitting();
diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp
index 3d05a30ac2..b7c3b113ba 100644
--- a/indra/llcommon/llworkerthread.cpp
+++ b/indra/llcommon/llworkerthread.cpp
@@ -39,10 +39,14 @@ LLWorkerThread::LLWorkerThread(const std::string& name, bool threaded, bool shou
{
mDeleteMutex = new LLMutex(NULL);
- if(!mLocalAPRFilePoolp)
- {
- mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
- }
+ // Removed LLVolatileAPRPool
+
+ // if(!mLocalAPRFilePoolp)
+ // {
+ // mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
+ // }
+
+ //
}
LLWorkerThread::~LLWorkerThread()
diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp
index 073b1af2a1..f0455b09dd 100644
--- a/indra/llvfs/lllfsthread.cpp
+++ b/indra/llvfs/lllfsthread.cpp
@@ -67,10 +67,14 @@ LLLFSThread::LLLFSThread(bool threaded) :
LLQueuedThread("LFS", threaded),
mPriorityCounter(PRIORITY_LOWBITS)
{
- if(!mLocalAPRFilePoolp)
- {
- mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
- }
+ // Removed LLVolatileAPRPool
+
+ // if(!mLocalAPRFilePoolp)
+ // {
+ // mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
+ // }
+
+ //
}
LLLFSThread::~LLLFSThread()
@@ -183,7 +187,12 @@ bool LLLFSThread::Request::processRequest()
{
llassert(mOffset >= 0);
LLAPRFile infile ; // auto-closes
- infile.open(mFileName, LL_APR_RB, mThread->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+ // infile.open(mFileName, LL_APR_RB, mThread->getLocalAPRFilePool());
+ infile.open(mFileName, LL_APR_RB, 0, 0);
+ //
+
if (!infile.getFileHandle())
{
llwarns << "LLLFS: Unable to read file: " << mFileName << llendl;
@@ -206,7 +215,12 @@ bool LLLFSThread::Request::processRequest()
if (mOffset < 0)
flags |= APR_APPEND;
LLAPRFile outfile ; // auto-closes
- outfile.open(mFileName, flags, mThread->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+ // outfile.open(mFileName, flags, mThread->getLocalAPRFilePool());
+ outfile.open(mFileName, flags, 0, 0);
+ //
+
if (!outfile.getFileHandle())
{
llwarns << "LLLFS: Unable to write file: " << mFileName << llendl;
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 8632890bbb..4760840927 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -177,7 +177,12 @@ private:
bool LLTextureCacheLocalFileWorker::doRead()
{
- S32 local_size = LLAPRFile::size(mFileName, mCache->getLocalAPRFilePool());
+ // Removed LLVolatileAPRPool
+
+ // S32 local_size = LLAPRFile::size(mFileName, mCache->getLocalAPRFilePool());
+ S32 local_size = LLAPRFile::size(mFileName, 0);
+
+ //
if (local_size > 0 && mFileName.size() > 4)
{
@@ -251,7 +256,12 @@ bool LLTextureCacheLocalFileWorker::doRead()
}
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
- S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
+ // Removed LLVolatileAPRPool
+
+ // S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
+ S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, 0);
+
+ //
if (bytes_read != mDataSize)
{
@@ -332,7 +342,14 @@ bool LLTextureCacheRemoteWorker::doRead()
// Is it a JPEG2000 file?
{
local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename, 0 );
+
+ //
+
if (local_size > 0)
{
mImageFormat = IMG_CODEC_J2C;
@@ -342,7 +359,14 @@ bool LLTextureCacheRemoteWorker::doRead()
if (local_size == 0)
{
local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename, 0);
+
+ //
+
if (local_size > 0)
{
mImageFormat = IMG_CODEC_JPEG;
@@ -353,7 +377,14 @@ bool LLTextureCacheRemoteWorker::doRead()
if (local_size == 0)
{
local_filename = filename + ".tga";
- local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename, 0);
+
+ //
+
if (local_size > 0)
{
mImageFormat = IMG_CODEC_TGA;
@@ -379,8 +410,15 @@ bool LLTextureCacheRemoteWorker::doRead()
}
// Allocate read buffer
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), mDataSize);
- S32 bytes_read = LLAPRFile::readEx(local_filename,
- mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // S32 bytes_read = LLAPRFile::readEx(local_filename,
+ // mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
+ S32 bytes_read = LLAPRFile::readEx(local_filename, mReadData, mOffset, mDataSize, 0);
+
+ //
+
if (bytes_read != mDataSize)
{
llwarns << "Error reading file from local cache: " << local_filename
@@ -431,8 +469,15 @@ bool LLTextureCacheRemoteWorker::doRead()
size = llmin(size, mDataSize);
// Allocate the read buffer
mReadData = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), size);
- S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName,
- mReadData, offset, size, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName,
+ // mReadData, offset, size, mCache->getLocalAPRFilePool());
+ S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, mReadData, offset, size, 0);
+
+ //
+
if (bytes_read != size)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -458,7 +503,13 @@ bool LLTextureCacheRemoteWorker::doRead()
if (!done && (mState == BODY))
{
std::string filename = mCache->getTextureFileName(mID);
- S32 filesize = LLAPRFile::size(filename, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // S32 filesize = LLAPRFile::size(filename, mCache->getLocalAPRFilePool());
+ S32 filesize = LLAPRFile::size(filename, 0);
+
+ // >
if (filesize && (filesize + TEXTURE_CACHE_ENTRY_SIZE) > mOffset)
{
@@ -498,10 +549,18 @@ bool LLTextureCacheRemoteWorker::doRead()
mReadData = data;
// Read the data at last
- S32 bytes_read = LLAPRFile::readEx(filename,
- mReadData + data_offset,
- file_offset, file_size,
- mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // S32 bytes_read = LLAPRFile::readEx(filename,
+ // mReadData + data_offset,
+ // file_offset, file_size,
+ // mCache->getLocalAPRFilePool());
+ S32 bytes_read = LLAPRFile::readEx(filename,mReadData + data_offset, file_offset, file_size, 0 );
+
+
+ //
+
if (bytes_read != file_size)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -602,13 +661,26 @@ bool LLTextureCacheRemoteWorker::doWrite()
U8* padBuffer = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), TEXTURE_CACHE_ENTRY_SIZE);
memset(padBuffer, 0, TEXTURE_CACHE_ENTRY_SIZE); // Init with zeros
memcpy(padBuffer, mWriteData, mDataSize); // Copy the write buffer
- bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, mCache->getLocalAPRFilePool());
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, 0);
+
+ //
+
FREE_MEM(LLImageBase::getPrivatePool(), padBuffer);
}
else
{
// Write the header record (== first TEXTURE_CACHE_ENTRY_SIZE bytes of the raw file) in the header file
- bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, mCache->getLocalAPRFilePool());
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, 0);
+
+ //
}
if (bytes_written <= 0)
@@ -641,10 +713,17 @@ bool LLTextureCacheRemoteWorker::doWrite()
// build the cache file name from the UUID
std::string filename = mCache->getTextureFileName(mID);
// llinfos << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << llendl;
- S32 bytes_written = LLAPRFile::writeEx( filename,
- mWriteData + TEXTURE_CACHE_ENTRY_SIZE,
- 0, file_size,
- mCache->getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // S32 bytes_written = LLAPRFile::writeEx( filename,
+ // mWriteData + TEXTURE_CACHE_ENTRY_SIZE,
+ // 0, file_size,
+ // mCache->getLocalAPRFilePool());
+ S32 bytes_written = LLAPRFile::writeEx( filename, mWriteData + TEXTURE_CACHE_ENTRY_SIZE, 0, file_size, 0);
+
+ //
+
if (bytes_written <= 0)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -847,7 +926,14 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// Is it a JPEG2000 file?
{
local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename, 0);
+
+ //
+
if (local_size > 0)
{
return TRUE ;
@@ -857,7 +943,14 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// If not, is it a jpeg file?
{
local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename, 0);
+
+ //
+
if (local_size > 0)
{
return TRUE ;
@@ -867,7 +960,14 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// Hmm... What about a targa file? (used for UI texture mostly)
{
local_filename = filename + ".tga";
- local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
+ local_size = LLAPRFile::size(local_filename, 0);
+
+ //
+
if (local_size > 0)
{
return TRUE ;
@@ -913,10 +1013,22 @@ void LLTextureCache::purgeCache(ELLPath location)
if(LLFile::isdir(mTexturesDirName))
{
std::string file_name = gDirUtilp->getExpandedFilename(location, entries_filename);
- LLAPRFile::remove(file_name, getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // LLAPRFile::remove(file_name, getLocalAPRFilePool());
+ LLAPRFile::remove(file_name, 0);
+
+ //
file_name = gDirUtilp->getExpandedFilename(location, cache_filename);
- LLAPRFile::remove(file_name, getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // LLAPRFile::remove(file_name, getLocalAPRFilePool());
+ LLAPRFile::remove(file_name, 0);
+
+ //
purgeAllTextures(true);
}
@@ -992,7 +1104,14 @@ LLAPRFile* LLTextureCache::openHeaderEntriesFile(bool readonly, S32 offset)
{
llassert_always(mHeaderAPRFile == NULL);
apr_int32_t flags = readonly ? APR_READ|APR_BINARY : APR_READ|APR_WRITE|APR_BINARY;
- mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, getLocalAPRFilePool());
+ mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, 0);
+
+ //
+
if(offset > 0)
{
mHeaderAPRFile->seek(APR_SET, offset);
@@ -1015,11 +1134,19 @@ void LLTextureCache::readEntriesHeader()
{
// mHeaderEntriesInfo initializes to default values so safe not to read it
llassert_always(mHeaderAPRFile == NULL);
- if (LLAPRFile::isExist(mHeaderEntriesFileName, getLocalAPRFilePool()))
+
+ // Removed LLVolatileAPRPool
+
+ // if (LLAPRFile::isExist(mHeaderEntriesFileName, getLocalAPRFilePool()))
+ // {
+ // LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
+ // getLocalAPRFilePool());
+ // }
+ if (LLAPRFile::isExist(mHeaderEntriesFileName, 0) )
{
- LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
- getLocalAPRFilePool());
+ LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo), 0);
}
+ //
else //create an empty entries header.
{
mHeaderEntriesInfo.mVersion = sHeaderCacheVersion ;
@@ -1033,8 +1160,13 @@ void LLTextureCache::writeEntriesHeader()
llassert_always(mHeaderAPRFile == NULL);
if (!mReadOnly)
{
- LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
- getLocalAPRFilePool());
+ // Removed LLVolatileAPRPool
+
+ // LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
+ // getLocalAPRFilePool());
+ LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo), 0);
+
+ //
}
}
@@ -1623,7 +1755,14 @@ void LLTextureCache::purgeTextures(bool validate)
if (uuididx == validate_idx)
{
LL_DEBUGS("TextureCache") << "Validating: " << filename << "Size: " << entries[idx].mBodySize << LL_ENDL;
- S32 bodysize = LLAPRFile::size(filename, getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // S32 bodysize = LLAPRFile::size(filename, getLocalAPRFilePool());
+ S32 bodysize = LLAPRFile::size(filename, 0);
+
+ //
+
if (bodysize != entries[idx].mBodySize)
{
LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize
@@ -1858,7 +1997,13 @@ void LLTextureCache::removeCachedTexture(const LLUUID& id)
mTexturesSizeMap.erase(id);
}
mHeaderIDMap.erase(id);
- LLAPRFile::remove(getTextureFileName(id), getLocalAPRFilePool());
+
+ // Removed LLVolatileAPRPool
+
+ // LLAPRFile::remove(getTextureFileName(id), getLocalAPRFilePool());
+ LLAPRFile::remove(getTextureFileName(id), 0);
+
+ //
}
//called after mHeaderMutex is locked.
@@ -1870,7 +2015,12 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
{
if (entry.mBodySize == 0) // Always attempt to remove when mBodySize > 0.
{
- if (LLAPRFile::isExist(filename, getLocalAPRFilePool())) // Sanity check. Shouldn't exist when body size is 0.
+ // Removed LLVolatileAPRPool
+
+ // if (LLAPRFile::isExist(filename, getLocalAPRFilePool())) // Sanity check. Shouldn't exist when body size is 0.
+ if (LLAPRFile::isExist(filename, 0)) // Sanity check. Shouldn't exist when body size is 0.
+ //
+
{
LL_WARNS("TextureCache") << "Entry has body size of zero but file " << filename << " exists. Deleting this file, too." << LL_ENDL;
}
@@ -1890,7 +2040,12 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
if (file_maybe_exists)
{
- LLAPRFile::remove(filename, getLocalAPRFilePool());
+ // Removed LLVolatileAPRPool
+
+ // LLAPRFile::remove(filename, getLocalAPRFilePool());
+ LLAPRFile::remove(filename, 0);
+
+ //
}
}
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index 7db19c5c1b..eace21112c 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -268,7 +268,10 @@ LLVOCache::LLVOCache():
mCacheSize(1)
{
mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
- mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
+
+ // Removed LLVolatileAPRPool
+ // mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
+ //
}
LLVOCache::~LLVOCache()
@@ -278,7 +281,10 @@ LLVOCache::~LLVOCache()
writeCacheHeader();
clearCacheInMemory();
}
- delete mLocalAPRFilePoolp;
+
+ // Removed LLVolatileAPRPool
+ // delete mLocalAPRFilePoolp;
+ //
}
void LLVOCache::setDirNames(ELLPath location)
@@ -435,7 +441,10 @@ void LLVOCache::removeFromCache(HeaderEntryInfo* entry)
std::string filename;
getObjectCacheFilename(entry->mHandle, filename);
- LLAPRFile::remove(filename, mLocalAPRFilePoolp);
+
+ // LLAPRFile::remove(filename, mLocalAPRFilePoolp);
+ LLAPRFile::remove(filename, 0);
+
entry->mTime = INVALID_TIME ;
updateEntry(entry) ; //update the head file.
}
@@ -452,9 +461,11 @@ void LLVOCache::readCacheHeader()
clearCacheInMemory();
bool success = true ;
- if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
+ // if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
+ if (LLAPRFile::isExist(mHeaderFileName, 0))
{
- LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+ // LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, 0 );
//read the meta element
success = check_read(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
@@ -539,7 +550,8 @@ void LLVOCache::writeCacheHeader()
bool success = true ;
{
- LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ // LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, 0);
//write the meta element
success = check_write(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
@@ -577,7 +589,9 @@ void LLVOCache::writeCacheHeader()
BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
{
- LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ // LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, 0);
+
apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ;
return check_write(&apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
@@ -603,7 +617,8 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
{
std::string filename;
getObjectCacheFilename(handle, filename);
- LLAPRFile apr_file(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+ // LLAPRFile apr_file(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(filename, APR_READ|APR_BINARY, 0);
LLUUID cache_id ;
success = check_read(&apr_file, cache_id.mData, UUID_BYTES) ;
@@ -726,7 +741,8 @@ void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry:
{
std::string filename;
getObjectCacheFilename(handle, filename);
- LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ // LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY, 0);
success = check_write(&apr_file, (void*)id.mData, UUID_BYTES) ;
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 14e3b4c793..4399cfe91b 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -142,7 +142,11 @@ private:
U32 mNumEntries;
std::string mHeaderFileName ;
std::string mObjectCacheDirName;
- LLVolatileAPRPool* mLocalAPRFilePoolp ;
+
+ // Removed LLVolatileAPRPool
+ // LLVolatileAPRPool* mLocalAPRFilePoolp ;
+ //
+
header_entry_queue_t mHeaderEntryQueue;
handle_entry_map_t mHandleEntryMap;