зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1351801 - Switch libjar over to ArenaAllocator. r=bsmedberg
This converts libjar over to using ArenaAllocator instead of plarena.h. All files can now be built in unified mode. MozReview-Commit-ID: Ev8yyhxqRr7
This commit is contained in:
Родитель
df043c04b6
Коммит
863c5ed327
|
@ -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',
|
||||
]
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче