summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp47
-rw-r--r--indra/newview/llappviewer.h2
-rw-r--r--indra/newview/llappviewerlinux.cpp1
-rw-r--r--indra/newview/llappviewerlinux_api_dbus.cpp14
-rw-r--r--indra/newview/llappviewermacosx.cpp1
-rw-r--r--indra/newview/llfloateranimpreview.cpp3
-rw-r--r--indra/newview/llmainlooprepeater.cpp2
-rw-r--r--indra/newview/lltexturecache.cpp61
-rw-r--r--indra/newview/lltexturecache.h3
-rw-r--r--indra/newview/lltexturefetch.cpp3
-rw-r--r--indra/newview/llviewermenufile.cpp3
-rw-r--r--indra/newview/llvoavatar.cpp3
-rw-r--r--indra/newview/llvocache.cpp54
-rw-r--r--indra/newview/llvocache.h5
-rw-r--r--indra/newview/llvoicevivox.cpp2
-rw-r--r--indra/newview/llwatchdog.cpp4
-rw-r--r--indra/newview/tests/llworldmap_test.cpp1
17 files changed, 116 insertions, 93 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 1f76e2af40..a23f809b71 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1026,7 +1026,7 @@ bool LLAppViewer::mainLoop()
//-------------------------------------------
// Create IO Pump to use for HTTP Requests.
- gServicePump = new LLPumpIO;
+ gServicePump = new LLPumpIO(gAPRPoolp);
LLHTTPClient::setPump(*gServicePump);
LLCurl::setCAFile(gDirUtilp->getCAFile());
@@ -1387,16 +1387,16 @@ bool LLAppViewer::cleanup()
}
// *TODO - generalize this and move DSO wrangling to a helper class -brad
- for(std::map<apr_dso_handle_t*, boost::shared_ptr<LLAPRPool> >::iterator plugin = mPlugins.begin();
- plugin != mPlugins.end(); ++plugin)
+ std::set<struct apr_dso_handle_t *>::const_iterator i;
+ for(i = mPlugins.begin(); i != mPlugins.end(); ++i)
{
int (*ll_plugin_stop_func)(void) = NULL;
- apr_status_t rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_stop_func, plugin->first, "ll_plugin_stop");
+ apr_status_t rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll_plugin_stop_func, *i, "ll_plugin_stop");
ll_plugin_stop_func();
- rv = apr_dso_unload(plugin->first);
+ rv = apr_dso_unload(*i);
}
- mPlugins.clear(); // Forget handles and destroy all memory pools.
+ mPlugins.clear();
//flag all elements as needing to be destroyed immediately
// to ensure shutdown order
@@ -1828,7 +1828,7 @@ bool LLAppViewer::initThreads()
if (LLFastTimer::sLog || LLFastTimer::sMetricLog)
{
- LLFastTimer::sLogLock = new LLMutex;
+ LLFastTimer::sLogLock = new LLMutex(NULL);
mFastTimerLogThread = new LLFastTimerLogThread(LLFastTimer::sLogName);
mFastTimerLogThread->start();
}
@@ -2969,7 +2969,8 @@ void LLAppViewer::handleViewerCrash()
else crash_file_name = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,ERROR_MARKER_FILE_NAME);
llinfos << "Creating crash marker file " << crash_file_name << llendl;
- LLAPRFile crash_file(crash_file_name, LL_APR_W);
+ LLAPRFile crash_file ;
+ crash_file.open(crash_file_name, LL_APR_W);
if (crash_file.getFileHandle())
{
LL_INFOS("MarkerFile") << "Created crash marker file " << crash_file_name << LL_ENDL;
@@ -3033,10 +3034,11 @@ bool LLAppViewer::anotherInstanceRunning()
LL_DEBUGS("MarkerFile") << "Checking marker file for lock..." << LL_ENDL;
//Freeze case checks
- if (LLAPRFile::isExist(marker_file, LL_APR_RB))
+ if (LLAPRFile::isExist(marker_file, NULL, LL_APR_RB))
{
// File exists, try opening with write permissions
- LLAPRFile outfile(marker_file, LL_APR_WB);
+ LLAPRFile outfile ;
+ outfile.open(marker_file, LL_APR_WB);
apr_file_t* fMarker = outfile.getFileHandle() ;
if (!fMarker)
{
@@ -3075,25 +3077,25 @@ void LLAppViewer::initMarkerFile()
std::string llerror_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, LLERROR_MARKER_FILE_NAME);
std::string error_marker_file = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ERROR_MARKER_FILE_NAME);
- if (LLAPRFile::isExist(mMarkerFileName, LL_APR_RB) && !anotherInstanceRunning())
+ if (LLAPRFile::isExist(mMarkerFileName, NULL, LL_APR_RB) && !anotherInstanceRunning())
{
gLastExecEvent = LAST_EXEC_FROZE;
LL_INFOS("MarkerFile") << "Exec marker found: program froze on previous execution" << LL_ENDL;
}
- if(LLAPRFile::isExist(logout_marker_file, LL_APR_RB))
+ if(LLAPRFile::isExist(logout_marker_file, NULL, LL_APR_RB))
{
gLastExecEvent = LAST_EXEC_LOGOUT_FROZE;
LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
LLAPRFile::remove(logout_marker_file);
}
- if(LLAPRFile::isExist(llerror_marker_file, LL_APR_RB))
+ if(LLAPRFile::isExist(llerror_marker_file, NULL, LL_APR_RB))
{
if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
else gLastExecEvent = LAST_EXEC_LLERROR_CRASH;
LL_INFOS("MarkerFile") << "Last exec LLError crashed, setting LastExecEvent to " << gLastExecEvent << LL_ENDL;
LLAPRFile::remove(llerror_marker_file);
}
- if(LLAPRFile::isExist(error_marker_file, LL_APR_RB))
+ if(LLAPRFile::isExist(error_marker_file, NULL, LL_APR_RB))
{
if(gLastExecEvent == LAST_EXEC_LOGOUT_FROZE) gLastExecEvent = LAST_EXEC_LOGOUT_CRASH;
else gLastExecEvent = LAST_EXEC_OTHER_CRASH;
@@ -3109,7 +3111,7 @@ void LLAppViewer::initMarkerFile()
// Create the marker file for this execution & lock it
apr_status_t s;
- s = mMarkerFile.open(mMarkerFileName, LL_APR_W, LLAPRFile::long_lived);
+ s = mMarkerFile.open(mMarkerFileName, LL_APR_W, TRUE);
if (s == APR_SUCCESS && mMarkerFile.getFileHandle())
{
@@ -4325,7 +4327,8 @@ void LLAppViewer::sendLogoutRequest()
gLogoutInProgress = TRUE;
mLogoutMarkerFileName = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,LOGOUT_MARKER_FILE_NAME);
- LLAPRFile outfile(mLogoutMarkerFileName, LL_APR_W);
+ LLAPRFile outfile ;
+ outfile.open(mLogoutMarkerFileName, LL_APR_W);
mLogoutMarkerFile = outfile.getFileHandle() ;
if (mLogoutMarkerFile)
{
@@ -4775,15 +4778,14 @@ void LLAppViewer::loadEventHostModule(S32 listen_port)
}
#endif // LL_WINDOWS
- boost::shared_ptr<LLAPRPool> eventhost_dso_memory_pool_ptr(new LLAPRPool);
- LLAPRPool& eventhost_dso_memory_pool(*eventhost_dso_memory_pool_ptr);
- apr_dso_handle_t* eventhost_dso_handle = NULL;
+ apr_dso_handle_t * eventhost_dso_handle = NULL;
+ apr_pool_t * eventhost_dso_memory_pool = NULL;
//attempt to load the shared library
- eventhost_dso_memory_pool.create();
+ apr_pool_create(&eventhost_dso_memory_pool, NULL);
apr_status_t rv = apr_dso_load(&eventhost_dso_handle,
dso_path.c_str(),
- eventhost_dso_memory_pool());
+ eventhost_dso_memory_pool);
llassert_always(! ll_apr_warn_status(rv, eventhost_dso_handle));
llassert_always(eventhost_dso_handle != NULL);
@@ -4803,8 +4805,7 @@ void LLAppViewer::loadEventHostModule(S32 listen_port)
llerrs << "problem loading eventhost plugin, status: " << status << llendl;
}
- // Store the handle and link it to the pool that was used to allocate it.
- mPlugins[eventhost_dso_handle] = eventhost_dso_memory_pool_ptr;
+ mPlugins.insert(eventhost_dso_handle);
}
void LLAppViewer::launchUpdater()
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 00b12d50ae..a18e6cbb02 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -266,7 +266,7 @@ private:
LLAllocator mAlloc;
- std::map<apr_dso_handle_t*, boost::shared_ptr<LLAPRPool> > mPlugins;
+ std::set<struct apr_dso_handle_t*> mPlugins;
U32 mAvailPhysicalMemInKB ;
U32 mAvailVirtualMemInKB ;
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index d4c6131c80..898cc1c0ba 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -110,7 +110,6 @@ int main( int argc, char **argv )
}
delete viewer_app_ptr;
viewer_app_ptr = NULL;
-
return 0;
}
diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp
index 1ae469dfcf..32e7e0a83d 100644
--- a/indra/newview/llappviewerlinux_api_dbus.cpp
+++ b/indra/newview/llappviewerlinux_api_dbus.cpp
@@ -27,11 +27,11 @@
#if LL_DBUS_ENABLED
#include "linden_common.h"
-#include "llaprpool.h"
extern "C" {
#include <dbus/dbus-glib.h>
+#include "apr_pools.h"
#include "apr_dso.h"
}
@@ -44,7 +44,7 @@ extern "C" {
#undef LL_DBUS_SYM
static bool sSymsGrabbed = false;
-static LLAPRPool sSymDBUSDSOMemoryPool;
+static apr_pool_t *sSymDBUSDSOMemoryPool = NULL;
static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL;
bool grab_dbus_syms(std::string dbus_dso_name)
@@ -63,11 +63,11 @@ bool grab_dbus_syms(std::string dbus_dso_name)
#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0)
//attempt to load the shared library
- sSymDBUSDSOMemoryPool.create();
+ apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle,
dbus_dso_name.c_str(),
- sSymDBUSDSOMemoryPool()) ))
+ sSymDBUSDSOMemoryPool) ))
{
INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
@@ -109,7 +109,11 @@ void ungrab_dbus_syms()
sSymDBUSDSOHandleG = NULL;
}
- sSymDBUSDSOMemoryPool.destroy();
+ if ( sSymDBUSDSOMemoryPool )
+ {
+ apr_pool_destroy(sSymDBUSDSOMemoryPool);
+ sSymDBUSDSOMemoryPool = NULL;
+ }
// NULL-out all of the symbols we'd grabbed
#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0)
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 13c8745eaf..1cd80986d8 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -113,7 +113,6 @@ int main( int argc, char **argv )
}
delete viewer_app_ptr;
viewer_app_ptr = NULL;
-
return 0;
}
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index 9b96332c10..deebd69ec1 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -223,7 +223,8 @@ BOOL LLFloaterAnimPreview::postBuild()
// now load bvh file
S32 file_size;
- LLAPRFile infile(mFilenameAndPath, LL_APR_RB, &file_size);
+ LLAPRFile infile ;
+ infile.open(mFilenameAndPath, LL_APR_RB, NULL, &file_size);
if (!infile.getFileHandle())
{
diff --git a/indra/newview/llmainlooprepeater.cpp b/indra/newview/llmainlooprepeater.cpp
index d73048a28b..5c020e6d98 100644
--- a/indra/newview/llmainlooprepeater.cpp
+++ b/indra/newview/llmainlooprepeater.cpp
@@ -46,7 +46,7 @@ void LLMainLoopRepeater::start(void)
{
if(mQueue != 0) return;
- mQueue = new LLThreadSafeQueue<LLSD>(1024);
+ mQueue = new LLThreadSafeQueue<LLSD>(gAPRPoolp, 1024);
mMainLoopConnection = LLEventPumps::instance().
obtain("mainloop").listen(LLEventPump::inventName(), boost::bind(&LLMainLoopRepeater::onMainLoop, this, _1));
mRepeaterConnection = LLEventPumps::instance().
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index a47ea8581a..f54214b95c 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -176,7 +176,7 @@ private:
bool LLTextureCacheLocalFileWorker::doRead()
{
- S32 local_size = LLAPRFile::size(mFileName);
+ S32 local_size = LLAPRFile::size(mFileName, mCache->getLocalAPRFilePool());
if (local_size > 0 && mFileName.size() > 4)
{
@@ -250,7 +250,7 @@ bool LLTextureCacheLocalFileWorker::doRead()
}
mReadData = new U8[mDataSize];
- S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize);
+ S32 bytes_read = LLAPRFile::readEx(mFileName, mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
if (bytes_read != mDataSize)
{
@@ -331,7 +331,7 @@ bool LLTextureCacheRemoteWorker::doRead()
// Is it a JPEG2000 file?
{
local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename);
+ local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
if (local_size > 0)
{
mImageFormat = IMG_CODEC_J2C;
@@ -341,7 +341,7 @@ bool LLTextureCacheRemoteWorker::doRead()
if (local_size == 0)
{
local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename);
+ local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
if (local_size > 0)
{
mImageFormat = IMG_CODEC_JPEG;
@@ -352,7 +352,7 @@ bool LLTextureCacheRemoteWorker::doRead()
if (local_size == 0)
{
local_filename = filename + ".tga";
- local_size = LLAPRFile::size(local_filename);
+ local_size = LLAPRFile::size(local_filename, mCache->getLocalAPRFilePool());
if (local_size > 0)
{
mImageFormat = IMG_CODEC_TGA;
@@ -378,7 +378,8 @@ bool LLTextureCacheRemoteWorker::doRead()
}
// Allocate read buffer
mReadData = new U8[mDataSize];
- S32 bytes_read = LLAPRFile::readEx(local_filename, mReadData, mOffset, mDataSize);
+ S32 bytes_read = LLAPRFile::readEx(local_filename,
+ mReadData, mOffset, mDataSize, mCache->getLocalAPRFilePool());
if (bytes_read != mDataSize)
{
llwarns << "Error reading file from local cache: " << local_filename
@@ -429,7 +430,8 @@ bool LLTextureCacheRemoteWorker::doRead()
size = llmin(size, mDataSize);
// Allocate the read buffer
mReadData = new U8[size];
- S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName, mReadData, offset, size);
+ S32 bytes_read = LLAPRFile::readEx(mCache->mHeaderDataFileName,
+ mReadData, offset, size, mCache->getLocalAPRFilePool());
if (bytes_read != size)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -455,7 +457,7 @@ bool LLTextureCacheRemoteWorker::doRead()
if (!done && (mState == BODY))
{
std::string filename = mCache->getTextureFileName(mID);
- S32 filesize = LLAPRFile::size(filename);
+ S32 filesize = LLAPRFile::size(filename, mCache->getLocalAPRFilePool());
if (filesize && (filesize + TEXTURE_CACHE_ENTRY_SIZE) > mOffset)
{
@@ -497,7 +499,8 @@ bool LLTextureCacheRemoteWorker::doRead()
// Read the data at last
S32 bytes_read = LLAPRFile::readEx(filename,
mReadData + data_offset,
- file_offset, file_size);
+ file_offset, file_size,
+ mCache->getLocalAPRFilePool());
if (bytes_read != file_size)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -598,13 +601,13 @@ bool LLTextureCacheRemoteWorker::doWrite()
U8* padBuffer = new U8[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);
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, padBuffer, offset, size, mCache->getLocalAPRFilePool());
delete [] 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);
+ bytes_written = LLAPRFile::writeEx(mCache->mHeaderDataFileName, mWriteData, offset, size, mCache->getLocalAPRFilePool());
}
if (bytes_written <= 0)
@@ -639,7 +642,8 @@ bool LLTextureCacheRemoteWorker::doWrite()
// llinfos << "Writing Body: " << filename << " Bytes: " << file_offset+file_size << llendl;
S32 bytes_written = LLAPRFile::writeEx( filename,
mWriteData + TEXTURE_CACHE_ENTRY_SIZE,
- 0, file_size);
+ 0, file_size,
+ mCache->getLocalAPRFilePool());
if (bytes_written <= 0)
{
llwarns << "LLTextureCacheWorker: " << mID
@@ -736,6 +740,9 @@ void LLTextureCacheWorker::endWork(S32 param, bool aborted)
LLTextureCache::LLTextureCache(bool threaded)
: LLWorkerThread("TextureCache", threaded),
+ mWorkersMutex(NULL),
+ mHeaderMutex(NULL),
+ mListMutex(NULL),
mHeaderAPRFile(NULL),
mReadOnly(TRUE), //do not allow to change the texture cache until setReadOnly() is called.
mTexturesSizeTotal(0),
@@ -839,7 +846,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// Is it a JPEG2000 file?
{
local_filename = filename + ".j2c";
- local_size = LLAPRFile::size(local_filename);
+ local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
if (local_size > 0)
{
return TRUE ;
@@ -849,7 +856,7 @@ BOOL LLTextureCache::isInLocal(const LLUUID& id)
// If not, is it a jpeg file?
{
local_filename = filename + ".jpg";
- local_size = LLAPRFile::size(local_filename);
+ local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
if (local_size > 0)
{
return TRUE ;
@@ -859,7 +866,7 @@ 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);
+ local_size = LLAPRFile::size(local_filename, getLocalAPRFilePool());
if (local_size > 0)
{
return TRUE ;
@@ -905,10 +912,10 @@ void LLTextureCache::purgeCache(ELLPath location)
if(LLFile::isdir(mTexturesDirName))
{
std::string file_name = gDirUtilp->getExpandedFilename(location, entries_filename);
- LLAPRFile::remove(file_name);
+ LLAPRFile::remove(file_name, getLocalAPRFilePool());
file_name = gDirUtilp->getExpandedFilename(location, cache_filename);
- LLAPRFile::remove(file_name);
+ LLAPRFile::remove(file_name, getLocalAPRFilePool());
purgeAllTextures(true);
}
@@ -984,9 +991,7 @@ 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;
- // All code calling openHeaderEntriesFile, immediately calls closeHeaderEntriesFile,
- // so this file is very short-lived.
- mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags);
+ mHeaderAPRFile = new LLAPRFile(mHeaderEntriesFileName, flags, getLocalAPRFilePool());
if(offset > 0)
{
mHeaderAPRFile->seek(APR_SET, offset);
@@ -1009,9 +1014,10 @@ void LLTextureCache::readEntriesHeader()
{
// mHeaderEntriesInfo initializes to default values so safe not to read it
llassert_always(mHeaderAPRFile == NULL);
- if (LLAPRFile::isExist(mHeaderEntriesFileName))
+ if (LLAPRFile::isExist(mHeaderEntriesFileName, getLocalAPRFilePool()))
{
- LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo));
+ LLAPRFile::readEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
+ getLocalAPRFilePool());
}
else //create an empty entries header.
{
@@ -1026,7 +1032,8 @@ void LLTextureCache::writeEntriesHeader()
llassert_always(mHeaderAPRFile == NULL);
if (!mReadOnly)
{
- LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo));
+ LLAPRFile::writeEx(mHeaderEntriesFileName, (U8*)&mHeaderEntriesInfo, 0, sizeof(EntriesInfo),
+ getLocalAPRFilePool());
}
}
@@ -1616,7 +1623,7 @@ 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);
+ S32 bodysize = LLAPRFile::size(filename, getLocalAPRFilePool());
if (bodysize != entries[idx].mBodySize)
{
LL_WARNS("TextureCache") << "TEXTURE CACHE BODY HAS BAD SIZE: " << bodysize << " != " << entries[idx].mBodySize
@@ -1851,7 +1858,7 @@ void LLTextureCache::removeCachedTexture(const LLUUID& id)
mTexturesSizeMap.erase(id);
}
mHeaderIDMap.erase(id);
- LLAPRFile::remove(getTextureFileName(id));
+ LLAPRFile::remove(getTextureFileName(id), getLocalAPRFilePool());
}
//called after mHeaderMutex is locked.
@@ -1863,7 +1870,7 @@ 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)) // Sanity check. Shouldn't exist when body size is 0.
+ if (LLAPRFile::isExist(filename, getLocalAPRFilePool())) // 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;
}
@@ -1884,7 +1891,7 @@ void LLTextureCache::removeEntry(S32 idx, Entry& entry, std::string& filename)
if (file_maybe_exists)
{
- LLAPRFile::remove(filename);
+ LLAPRFile::remove(filename, getLocalAPRFilePool());
}
}
diff --git a/indra/newview/lltexturecache.h b/indra/newview/lltexturecache.h
index 79f5ba5835..64e3a2658c 100644
--- a/indra/newview/lltexturecache.h
+++ b/indra/newview/lltexturecache.h
@@ -142,6 +142,9 @@ protected:
std::string getTextureFileName(const LLUUID& id);
void addCompleted(Responder* responder, bool success);
+protected:
+ //void setFileAPRPool(apr_pool_t* pool) { mFileAPRPool = pool ; }
+
private:
void setDirNames(ELLPath location);
void readHeaderCache();
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 139b434aeb..18c3a3b87d 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -674,6 +674,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher,
mRetryAttempt(0),
mActiveCount(0),
mGetStatus(0),
+ mWorkMutex(NULL),
mFirstPacket(0),
mLastPacket(-1),
mTotalPackets(0),
@@ -1815,6 +1816,8 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image
mDebugPause(FALSE),
mPacketCount(0),
mBadPacketCount(0),
+ mQueueMutex(getAPRPool()),
+ mNetworkQueueMutex(getAPRPool()),
mTextureCache(cache),
mImageDecodeThread(imagedecodethread),
mTextureBandwidth(0),
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 6bee7556cd..fda291f3c1 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -736,7 +736,8 @@ void upload_new_resource(const std::string& src_filename, std::string name,
uuid = tid.makeAssetID(gAgent.getSecureSessionID());
// copy this file into the vfs for upload
S32 file_size;
- LLAPRFile infile(filename, LL_APR_RB, &file_size);
+ LLAPRFile infile ;
+ infile.open(filename, LL_APR_RB, NULL, &file_size);
if (infile.getFileHandle())
{
LLVFile file(gVFS, uuid, asset_type, LLVFile::WRITE);
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 2cd9b09932..fd89044995 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -7190,7 +7190,8 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
// static
void LLVOAvatar::dumpArchetypeXML( void* )
{
- LLAPRFile outfile(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER, "new archetype.xml"), LL_APR_WB);
+ LLAPRFile outfile;
+ outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB );
apr_file_t* file = outfile.getFileHandle() ;
if (!file)
{
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index d25831b4f1..a933500706 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -30,14 +30,14 @@
#include "llregionhandle.h"
#include "llviewercontrol.h"
-static BOOL check_read(LLAPRFile& apr_file, void* src, S32 n_bytes)
+BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes)
{
- return apr_file.read(src, n_bytes) == n_bytes ;
+ return apr_file->read(src, n_bytes) == n_bytes ;
}
-static BOOL check_write(LLAPRFile& apr_file, void* src, S32 n_bytes)
+BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes)
{
- return apr_file.write(src, n_bytes) == n_bytes ;
+ return apr_file->write(src, n_bytes) == n_bytes ;
}
@@ -70,7 +70,7 @@ LLVOCacheEntry::LLVOCacheEntry()
mDP.assignBuffer(mBuffer, 0);
}
-LLVOCacheEntry::LLVOCacheEntry(LLAPRFile& apr_file)
+LLVOCacheEntry::LLVOCacheEntry(LLAPRFile* apr_file)
{
S32 size = -1;
BOOL success;
@@ -185,7 +185,7 @@ void LLVOCacheEntry::dump() const
<< llendl;
}
-BOOL LLVOCacheEntry::writeToFile(LLAPRFile& apr_file) const
+BOOL LLVOCacheEntry::writeToFile(LLAPRFile* apr_file) const
{
BOOL success;
success = check_write(apr_file, (void*)&mLocalID, sizeof(U32));
@@ -266,6 +266,7 @@ LLVOCache::LLVOCache():
mCacheSize(1)
{
mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
+ mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
}
LLVOCache::~LLVOCache()
@@ -275,6 +276,7 @@ LLVOCache::~LLVOCache()
writeCacheHeader();
clearCacheInMemory();
}
+ delete mLocalAPRFilePoolp;
}
void LLVOCache::setDirNames(ELLPath location)
@@ -435,7 +437,7 @@ void LLVOCache::removeFromCache(HeaderEntryInfo* entry)
std::string filename;
getObjectCacheFilename(entry->mHandle, filename);
- LLAPRFile::remove(filename);
+ LLAPRFile::remove(filename, mLocalAPRFilePoolp);
entry->mTime = INVALID_TIME ;
updateEntry(entry) ; //update the head file.
}
@@ -452,12 +454,12 @@ void LLVOCache::readCacheHeader()
clearCacheInMemory();
bool success = true ;
- if (LLAPRFile::isExist(mHeaderFileName))
+ if (LLAPRFile::isExist(mHeaderFileName, mLocalAPRFilePoolp))
{
- LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY);
+ LLAPRFile apr_file(mHeaderFileName, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
//read the meta element
- success = check_read(apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
+ success = check_read(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
if(success)
{
@@ -470,7 +472,7 @@ void LLVOCache::readCacheHeader()
{
entry = new HeaderEntryInfo() ;
}
- success = check_read(apr_file, entry, sizeof(HeaderEntryInfo));
+ success = check_read(&apr_file, entry, sizeof(HeaderEntryInfo));
if(!success) //failed
{
@@ -539,17 +541,17 @@ void LLVOCache::writeCacheHeader()
bool success = true ;
{
- LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY);
+ LLAPRFile apr_file(mHeaderFileName, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
//write the meta element
- success = check_write(apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
+ success = check_write(&apr_file, &mMetaInfo, sizeof(HeaderMetaInfo)) ;
mNumEntries = 0 ;
for(header_entry_queue_t::iterator iter = mHeaderEntryQueue.begin() ; success && iter != mHeaderEntryQueue.end(); ++iter)
{
(*iter)->mIndex = mNumEntries++ ;
- success = check_write(apr_file, (void*)*iter, sizeof(HeaderEntryInfo));
+ success = check_write(&apr_file, (void*)*iter, sizeof(HeaderEntryInfo));
}
mNumEntries = mHeaderEntryQueue.size() ;
@@ -560,7 +562,7 @@ void LLVOCache::writeCacheHeader()
for(S32 i = mNumEntries ; success && i < MAX_NUM_OBJECT_ENTRIES ; i++)
{
//fill the cache with the default entry.
- success = check_write(apr_file, entry, sizeof(HeaderEntryInfo)) ;
+ success = check_write(&apr_file, entry, sizeof(HeaderEntryInfo)) ;
}
delete entry ;
@@ -577,10 +579,10 @@ void LLVOCache::writeCacheHeader()
BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
{
- LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY);
- apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo));
+ LLAPRFile apr_file(mHeaderFileName, APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
+ apr_file.seek(APR_SET, entry->mIndex * sizeof(HeaderEntryInfo) + sizeof(HeaderMetaInfo)) ;
- return check_write(apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
+ return check_write(&apr_file, (void*)entry, sizeof(HeaderEntryInfo)) ;
}
void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map)
@@ -603,10 +605,10 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
{
std::string filename;
getObjectCacheFilename(handle, filename);
- LLAPRFile apr_file(filename, APR_READ|APR_BINARY);
+ LLAPRFile apr_file(filename, APR_READ|APR_BINARY, mLocalAPRFilePoolp);
LLUUID cache_id ;
- success = check_read(apr_file, cache_id.mData, UUID_BYTES) ;
+ success = check_read(&apr_file, cache_id.mData, UUID_BYTES) ;
if(success)
{
@@ -619,11 +621,11 @@ void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::voca
if(success)
{
S32 num_entries;
- success = check_read(apr_file, &num_entries, sizeof(S32)) ;
+ success = check_read(&apr_file, &num_entries, sizeof(S32)) ;
for (S32 i = 0; success && i < num_entries; i++)
{
- LLVOCacheEntry* entry = new LLVOCacheEntry(apr_file);
+ LLVOCacheEntry* entry = new LLVOCacheEntry(&apr_file);
if (!entry->getLocalID())
{
llwarns << "Aborting cache file load for " << filename << ", cache file corruption!" << llendl;
@@ -722,19 +724,19 @@ 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);
+ LLAPRFile apr_file(filename, APR_CREATE|APR_WRITE|APR_BINARY, mLocalAPRFilePoolp);
- success = check_write(apr_file, (void*)id.mData, UUID_BYTES) ;
+ success = check_write(&apr_file, (void*)id.mData, UUID_BYTES) ;
if(success)
{
S32 num_entries = cache_entry_map.size() ;
- success = check_write(apr_file, &num_entries, sizeof(S32));
+ success = check_write(&apr_file, &num_entries, sizeof(S32));
for (LLVOCacheEntry::vocache_entry_map_t::const_iterator iter = cache_entry_map.begin(); success && iter != cache_entry_map.end(); ++iter)
{
- success = iter->second->writeToFile(apr_file) ;
+ success = iter->second->writeToFile(&apr_file) ;
}
}
}
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index 76456b9e98..14e3b4c793 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -41,7 +41,7 @@ class LLVOCacheEntry
{
public:
LLVOCacheEntry(U32 local_id, U32 crc, LLDataPackerBinaryBuffer &dp);
- LLVOCacheEntry(LLAPRFile& apr_file);
+ LLVOCacheEntry(LLAPRFile* apr_file);
LLVOCacheEntry();
~LLVOCacheEntry();
@@ -51,7 +51,7 @@ public:
S32 getCRCChangeCount() const { return mCRCChangeCount; }
void dump() const;
- BOOL writeToFile(LLAPRFile& apr_file) const;
+ BOOL writeToFile(LLAPRFile* apr_file) const;
void assignCRC(U32 crc, LLDataPackerBinaryBuffer &dp);
LLDataPackerBinaryBuffer *getDP(U32 crc);
void recordHit();
@@ -142,6 +142,7 @@ private:
U32 mNumEntries;
std::string mHeaderFileName ;
std::string mObjectCacheDirName;
+ LLVolatileAPRPool* mLocalAPRFilePoolp ;
header_entry_queue_t mHeaderEntryQueue;
handle_entry_map_t mHandleEntryMap;
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 828207ce1a..08e242af8e 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -961,7 +961,7 @@ void LLVivoxVoiceClient::stateMachine()
if(!mSocket)
{
- mSocket = LLSocket::create(LLSocket::STREAM_TCP);
+ mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);
}
mConnected = mSocket->blockingConnect(mDaemonHost);
diff --git a/indra/newview/llwatchdog.cpp b/indra/newview/llwatchdog.cpp
index d982ca5020..1694126802 100644
--- a/indra/newview/llwatchdog.cpp
+++ b/indra/newview/llwatchdog.cpp
@@ -178,8 +178,8 @@ void LLWatchdog::init(killer_event_callback func)
mKillerCallback = func;
if(!mSuspectsAccessMutex && !mTimer)
{
- mSuspectsAccessMutex = new LLMutex;
- mTimer = new LLWatchdogTimerThread;
+ mSuspectsAccessMutex = new LLMutex(NULL);
+ mTimer = new LLWatchdogTimerThread();
mTimer->setSleepTime(WATCHDOG_SLEEP_TIME_USEC / 1000);
mLastClockCount = LLTimer::getTotalTime();
diff --git a/indra/newview/tests/llworldmap_test.cpp b/indra/newview/tests/llworldmap_test.cpp
index 102294959a..acc6e814bc 100644
--- a/indra/newview/tests/llworldmap_test.cpp
+++ b/indra/newview/tests/llworldmap_test.cpp
@@ -27,6 +27,7 @@
// Dependencies
#include "linden_common.h"
+#include "llapr.h"
#include "llsingleton.h"
#include "lltrans.h"
#include "lluistring.h"