diff --git a/modules/libjar/moz.build b/modules/libjar/moz.build index 8fcf043127a0..7860db80c5cd 100644 --- a/modules/libjar/moz.build +++ b/modules/libjar/moz.build @@ -32,16 +32,12 @@ EXPORTS += [ ] UNIFIED_SOURCES += [ - 'nsJARProtocolHandler.cpp', - 'nsJARURI.cpp', -] - -# These files cannot be built in unified mode because they rely on plarena.h. -SOURCES += [ 'nsJAR.cpp', 'nsJARChannel.cpp', 'nsJARFactory.cpp', 'nsJARInputStream.cpp', + 'nsJARProtocolHandler.cpp', + 'nsJARURI.cpp', 'nsZipArchive.cpp', ] diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index f07c42a62aad..7993ebf474c2 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -10,11 +10,6 @@ * or pointers to it across thread boundaries. */ -// This must be the first include in the file in order for the -// PL_ARENA_CONST_ALIGN_MASK macro to be effective. -#define PL_ARENA_CONST_ALIGN_MASK (sizeof(void*)-1) -#include "plarena.h" - #define READTYPE int32_t #include "zlib.h" #include "nsISupportsUtils.h" @@ -356,9 +351,6 @@ nsresult nsZipArchive::OpenArchive(nsZipHandle *aZipHandle, PRFileDesc *aFd) { mFd = aZipHandle; - // Initialize our arena - PL_INIT_ARENA_POOL(&mArena, "ZipArena", ZIP_ARENABLOCKSIZE); - //-- get table of contents for archive nsresult rv = BuildFileList(aFd); if (NS_SUCCEEDED(rv)) { @@ -427,7 +419,7 @@ nsresult nsZipArchive::Test(const char *aEntryName) nsresult nsZipArchive::CloseArchive() { if (mFd) { - PL_FinishArenaPool(&mArena); + mArena.Clear(); mFd = nullptr; } @@ -667,9 +659,7 @@ static nsresult ResolveSymlink(const char *path) nsZipItem* nsZipArchive::CreateZipItem() { // Arena allocate the nsZipItem - void *mem; - PL_ARENA_ALLOCATE(mem, &mArena, sizeof(nsZipItem)); - return (nsZipItem*)mem; + return (nsZipItem*)mArena.Allocate(sizeof(nsZipItem)); } //--------------------------------------------- diff --git a/modules/libjar/nsZipArchive.h b/modules/libjar/nsZipArchive.h index 2de67903277f..373492370468 100644 --- a/modules/libjar/nsZipArchive.h +++ b/modules/libjar/nsZipArchive.h @@ -11,12 +11,12 @@ #define ZIP_TABSIZE 256 #define ZIP_BUFLEN (4*1024) /* Used as output buffer when deflating items to a file */ -#include "plarena.h" #include "zlib.h" #include "zipstruct.h" #include "nsAutoPtr.h" #include "nsIFile.h" #include "nsISupportsImpl.h" // For mozilla::ThreadSafeAutoRefCnt +#include "mozilla/ArenaAllocator.h" #include "mozilla/FileUtils.h" #include "mozilla/FileLocation.h" #include "mozilla/UniquePtr.h" @@ -217,7 +217,7 @@ private: NS_DECL_OWNINGTHREAD nsZipItem* mFiles[ZIP_TABSIZE]; - PLArenaPool mArena; + mozilla::ArenaAllocator<1024, sizeof(void*)> mArena; const char* mCommentPtr; uint16_t mCommentLen;