Bug 210337 - Spring cleaning of unused XPCOM code and callers r/sr=alecf/bz
git-svn-id: svn://10.0.0.236/trunk@144063 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
889c257b53
commit
03384bfad0
@ -37,7 +37,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSRule.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
|
||||
nsCSSRule::nsCSSRule(void)
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIArena;
|
||||
class nsIStyleSheet;
|
||||
class nsICSSStyleSheet;
|
||||
class nsIPresContext;
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
#include "plarena.h"
|
||||
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -47,7 +47,6 @@
|
||||
#include "nsString.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIHTMLCSSStyleSheet.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
*/
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIHTMLStyleSheet.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -48,7 +48,6 @@
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIArena;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSStyleSheet;
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -63,7 +63,6 @@ class nsStyleContext;
|
||||
class nsIFrameSelection;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIArena;
|
||||
class nsIReflowCallback;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMNode;
|
||||
|
||||
@ -63,7 +63,6 @@ class nsStyleContext;
|
||||
class nsIFrameSelection;
|
||||
class nsIFrameManager;
|
||||
class nsILayoutHistoryState;
|
||||
class nsIArena;
|
||||
class nsIReflowCallback;
|
||||
class nsISupportsArray;
|
||||
class nsIDOMNode;
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIView.h"
|
||||
@ -647,7 +646,7 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
|
||||
}
|
||||
|
||||
// Deleting the frame doesn't really free the memory, since we're using an
|
||||
// nsIArena for allocation, but we will get our destructors called.
|
||||
// arena for allocation, but we will get our destructors called.
|
||||
delete this;
|
||||
|
||||
// Now that we're totally cleaned out, we need to add ourselves to the presshell's
|
||||
|
||||
@ -140,7 +140,7 @@ public:
|
||||
void* operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW;
|
||||
|
||||
// Overridden to prevent the global delete from being called, since the memory
|
||||
// came out of an nsIArena instead of the global delete operator's heap.
|
||||
// came out of an arena instead of the global delete operator's heap.
|
||||
// XXX Would like to make this private some day, but our UNIX compilers can't
|
||||
// deal with it.
|
||||
void operator delete(void* aPtr, size_t sz);
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsReflowType.h"
|
||||
class nsHTMLReflowCommand;
|
||||
class nsIArena;
|
||||
class nsIAtom;
|
||||
class nsINodeInfo;
|
||||
class nsIContent;
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
#include "nsLineLayout.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIView.h"
|
||||
@ -647,7 +646,7 @@ nsFrame::Destroy(nsIPresContext* aPresContext)
|
||||
}
|
||||
|
||||
// Deleting the frame doesn't really free the memory, since we're using an
|
||||
// nsIArena for allocation, but we will get our destructors called.
|
||||
// arena for allocation, but we will get our destructors called.
|
||||
delete this;
|
||||
|
||||
// Now that we're totally cleaned out, we need to add ourselves to the presshell's
|
||||
|
||||
@ -140,7 +140,7 @@ public:
|
||||
void* operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW;
|
||||
|
||||
// Overridden to prevent the global delete from being called, since the memory
|
||||
// came out of an nsIArena instead of the global delete operator's heap.
|
||||
// came out of an arena instead of the global delete operator's heap.
|
||||
// XXX Would like to make this private some day, but our UNIX compilers can't
|
||||
// deal with it.
|
||||
void operator delete(void* aPtr, size_t sz);
|
||||
|
||||
@ -41,7 +41,6 @@
|
||||
#include "nsISupports.h"
|
||||
#include "nsReflowType.h"
|
||||
class nsHTMLReflowCommand;
|
||||
class nsIArena;
|
||||
class nsIAtom;
|
||||
class nsINodeInfo;
|
||||
class nsIContent;
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsCSSRule.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
|
||||
nsCSSRule::nsCSSRule(void)
|
||||
|
||||
@ -40,7 +40,6 @@
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIArena;
|
||||
class nsIStyleSheet;
|
||||
class nsICSSStyleSheet;
|
||||
class nsIPresContext;
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsString.h"
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
#include "plarena.h"
|
||||
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIHTMLCSSStyleSheet.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -29,7 +29,6 @@
|
||||
*/
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIHTMLStyleSheet.h"
|
||||
#include "nsIArena.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -48,7 +48,6 @@
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIArena;
|
||||
class nsCSSDeclaration;
|
||||
class nsICSSStyleSheet;
|
||||
|
||||
|
||||
@ -63,7 +63,6 @@
|
||||
#include "xptcall.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsHashtableEnumerator.h"
|
||||
#include "nsIPipe.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsCWeakReference.h"
|
||||
@ -137,7 +136,6 @@ void XXXNeverCalled()
|
||||
XPTI_GetInterfaceInfoManager();
|
||||
NS_NewGenericFactory(nsnull, nsnull);
|
||||
NS_NewGenericModule2(nsnull, nsnull);
|
||||
NS_NewHashtableEnumerator(nsnull, nsnull, nsnull, nsnull);
|
||||
nsCWeakProxy(0, 0);
|
||||
nsCWeakReferent(0);
|
||||
NS_GetWeakReference(nsnull);
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
|
||||
#include "nsMemoryImpl.h"
|
||||
#include "nsErrorService.h"
|
||||
#include "nsArena.h"
|
||||
#include "nsByteBuffer.h"
|
||||
|
||||
#include "nsSupportsArray.h"
|
||||
@ -284,7 +283,6 @@ static const nsModuleComponentInfo components[] = {
|
||||
#define NS_ERRORSERVICE_CLASSNAME NS_ERRORSERVICE_NAME
|
||||
COMPONENT(ERRORSERVICE, nsErrorService::Create),
|
||||
|
||||
COMPONENT(ARENA, ArenaImpl::Create),
|
||||
COMPONENT(BYTEBUFFER, ByteBufferImpl::Create),
|
||||
COMPONENT(SCRIPTABLEINPUTSTREAM, nsScriptableInputStream::Create),
|
||||
COMPONENT(BINARYINPUTSTREAM, nsBinaryInputStreamConstructor),
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
#include "nsIModule.h"
|
||||
#include "xcDll.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsHashtableEnumerator.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
@ -41,7 +41,6 @@ CSRCS = \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsArena.cpp \
|
||||
nsAtomTable.cpp \
|
||||
nsAtomService.cpp \
|
||||
nsByteBuffer.cpp \
|
||||
@ -53,7 +52,6 @@ CPPSRCS = \
|
||||
nsFixedSizeAllocator.cpp \
|
||||
nsHashSets.cpp \
|
||||
nsHashtable.cpp \
|
||||
nsHashtableEnumerator.cpp \
|
||||
nsObserver.cpp \
|
||||
nsObserverList.cpp \
|
||||
nsObserverService.cpp \
|
||||
@ -95,8 +93,6 @@ EXPORTS = \
|
||||
nsHashSets.h \
|
||||
nsHashKeys.h \
|
||||
nsHashtable.h \
|
||||
nsHashtableEnumerator.h \
|
||||
nsIArena.h \
|
||||
nsIByteBuffer.h \
|
||||
nsIUnicharBuffer.h \
|
||||
nsInt64.h \
|
||||
|
||||
@ -1,116 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsArena.h"
|
||||
#include "nsCRT.h"
|
||||
|
||||
ArenaImpl::ArenaImpl(void)
|
||||
: mInitialized(PR_FALSE)
|
||||
{
|
||||
memset(&mPool, 0, sizeof(PLArenaPool));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArenaImpl::Init(PRUint32 aBlockSize)
|
||||
{
|
||||
if (aBlockSize < NS_MIN_ARENA_BLOCK_SIZE) {
|
||||
aBlockSize = NS_DEFAULT_ARENA_BLOCK_SIZE;
|
||||
}
|
||||
PL_INIT_ARENA_POOL(&mPool, "nsIArena", aBlockSize);
|
||||
mBlockSize = aBlockSize;
|
||||
mInitialized = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ArenaImpl, nsIArena)
|
||||
|
||||
ArenaImpl::~ArenaImpl()
|
||||
{
|
||||
if (mInitialized)
|
||||
PL_FinishArenaPool(&mPool);
|
||||
|
||||
mInitialized = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void*)
|
||||
ArenaImpl::Alloc(PRUint32 size)
|
||||
{
|
||||
// Adjust size so that it's a multiple of sizeof(double)
|
||||
PRUint32 align = size & (sizeof(double) - 1);
|
||||
if (0 != align) {
|
||||
size += sizeof(double) - align;
|
||||
}
|
||||
|
||||
void* p;
|
||||
PL_ARENA_ALLOCATE(p, &mPool, size);
|
||||
return p;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
ArenaImpl::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
ArenaImpl* it = new ArenaImpl();
|
||||
if (nsnull == it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(it);
|
||||
nsresult rv = it->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(it);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_COM nsresult NS_NewHeapArena(nsIArena** aInstancePtrResult,
|
||||
PRUint32 aArenaBlockSize)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIArena* arena;
|
||||
rv = ArenaImpl::Create(NULL, NS_GET_IID(nsIArena), (void**)&arena);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = arena->Init(aArenaBlockSize);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(arena);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aInstancePtrResult = arena;
|
||||
return rv;
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsArena_h__
|
||||
#define nsArena_h__
|
||||
|
||||
#include "nsIArena.h"
|
||||
|
||||
#define PL_ARENA_CONST_ALIGN_MASK 7
|
||||
#include "plarena.h"
|
||||
|
||||
// Simple arena implementation layered on plarena
|
||||
class ArenaImpl : public nsIArena {
|
||||
public:
|
||||
ArenaImpl(void);
|
||||
virtual ~ArenaImpl();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
NS_IMETHOD Init(PRUint32 arenaBlockSize);
|
||||
|
||||
NS_IMETHOD_(void*) Alloc(PRUint32 size);
|
||||
|
||||
protected:
|
||||
PLArenaPool mPool;
|
||||
PRUint32 mBlockSize;
|
||||
|
||||
private:
|
||||
PRBool mInitialized;
|
||||
};
|
||||
|
||||
#endif // nsArena_h__
|
||||
@ -1,176 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rob Ginda <rginda@ix.netcom.com>
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* Implementation of nsHashEnumerator.
|
||||
* Use it to expose nsISimpleEnumerator interfaces around nsHashtable objects.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsHashtableEnumerator.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
||||
struct nsHashEnumClosure
|
||||
{
|
||||
nsHashEnumeratorConverterFunc Converter;
|
||||
nsISupports **Elements;
|
||||
PRUint32 Current;
|
||||
void *Data;
|
||||
};
|
||||
|
||||
PRBool PR_CALLBACK
|
||||
hash_enumerator(nsHashKey *aKey, void *aObject, void *closure)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsHashEnumClosure *c = (nsHashEnumClosure *)closure;
|
||||
|
||||
rv = c->Converter(aKey, (void *)aObject, (void *)c->Data,
|
||||
&c->Elements[c->Current]);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
c->Current++;
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
}
|
||||
|
||||
class nsHashtableEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
nsHashtableEnumerator(nsHashtable *aHash,
|
||||
nsHashEnumeratorConverterFunc aConverter,
|
||||
void* aData);
|
||||
virtual ~nsHashtableEnumerator();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
|
||||
void* operator new (size_t size, nsHashtable* aArray) CPP_THROW_NEW;
|
||||
void operator delete(void* ptr) {
|
||||
::operator delete(ptr);
|
||||
}
|
||||
|
||||
private:
|
||||
// not to be implemented
|
||||
void* operator new (size_t size);
|
||||
|
||||
PRUint32 mCurrent;
|
||||
PRUint32 mCount;
|
||||
nsISupports* mElements[1];
|
||||
};
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewHashtableEnumerator(nsHashtable *aHash,
|
||||
nsHashEnumeratorConverterFunc aConverter,
|
||||
void* aData, nsISimpleEnumerator **retval)
|
||||
{
|
||||
*retval = nsnull;
|
||||
|
||||
nsHashtableEnumerator *hte =
|
||||
new (aHash) nsHashtableEnumerator(aHash, aConverter, aData);
|
||||
|
||||
if (!hte)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*retval = NS_STATIC_CAST(nsISimpleEnumerator*, hte);
|
||||
NS_ADDREF(*retval);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void*
|
||||
nsHashtableEnumerator::operator new(size_t size, nsHashtable* aHash)
|
||||
CPP_THROW_NEW
|
||||
{
|
||||
// create enough space such that mValueArray points to a large
|
||||
// enough value. Note that the initial value of size gives us
|
||||
// space for mValueArray[0], so we must subtract
|
||||
size += (aHash->Count() - 1) * sizeof(nsISupports*);
|
||||
|
||||
// do the actual allocation
|
||||
nsHashtableEnumerator * result =
|
||||
NS_STATIC_CAST(nsHashtableEnumerator*, ::operator new(size));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsHashtableEnumerator, nsISimpleEnumerator)
|
||||
|
||||
nsHashtableEnumerator::nsHashtableEnumerator(nsHashtable *aHash,
|
||||
nsHashEnumeratorConverterFunc
|
||||
aConverter,
|
||||
void* aData)
|
||||
{
|
||||
nsHashEnumClosure c;
|
||||
c.Current = mCurrent = 0;
|
||||
c.Elements = mElements;
|
||||
c.Data = aData;
|
||||
c.Converter = aConverter;
|
||||
aHash->Enumerate(&hash_enumerator, &c);
|
||||
|
||||
mCount = c.Current; /* some items may not have converted correctly */
|
||||
|
||||
}
|
||||
|
||||
nsHashtableEnumerator::~nsHashtableEnumerator()
|
||||
{
|
||||
for (;mCurrent<mCount; mCurrent++)
|
||||
NS_RELEASE(mElements[mCurrent]);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashtableEnumerator::HasMoreElements(PRBool *aResult)
|
||||
{
|
||||
*aResult = (mCurrent < mCount);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashtableEnumerator::GetNext(nsISupports** aResult)
|
||||
{
|
||||
if (mCurrent >= mCount) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
*aResult = mElements[mCurrent++];
|
||||
// no need to addref - we'll just steal the refcount from the
|
||||
// array of elements.. this is safe because the enumerator can
|
||||
// only advance through the list once.
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* This class can be used to expose nsI(BiDirectional)Enumerator interfaces
|
||||
* around nsHashtable objects.
|
||||
* Contributed by Rob Ginda, rginda@ix.netcom.com
|
||||
*/
|
||||
|
||||
#ifndef nsHashtableEnumerator_h___
|
||||
#define nsHashtableEnumerator_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
class nsISimpleEnumerator;
|
||||
|
||||
typedef NS_CALLBACK(nsHashEnumeratorConverterFunc) (nsHashKey *key, void *data,
|
||||
void *convert_data,
|
||||
nsISupports **retval);
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewHashtableEnumerator(nsHashtable *aHash,
|
||||
nsHashEnumeratorConverterFunc aConverter,
|
||||
void *aData, nsISimpleEnumerator **retval);
|
||||
|
||||
#endif /* nsHashtableEnumerator_h___ */
|
||||
|
||||
@ -1,86 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsIArena_h___
|
||||
#define nsIArena_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_MIN_ARENA_BLOCK_SIZE 64
|
||||
#define NS_DEFAULT_ARENA_BLOCK_SIZE 4096
|
||||
|
||||
/// Interface IID for nsIArena
|
||||
#define NS_IARENA_IID \
|
||||
{ 0xa24fdad0, 0x93b4, 0x11d1, \
|
||||
{0x89, 0x5b, 0x00, 0x60, 0x08, 0x91, 0x1b, 0x81} }
|
||||
#define NS_ARENA_CONTRACTID "@mozilla.org/arena;1"
|
||||
#define NS_ARENA_CLASSNAME "Arena"
|
||||
|
||||
/** Interface to a memory arena abstraction. Arena's use large blocks
|
||||
* of memory to allocate smaller objects. Arena's provide no free
|
||||
* operator; instead, all of the objects in the arena are deallocated
|
||||
* by deallocating the arena (e.g. when it's reference count goes to
|
||||
* zero)
|
||||
*/
|
||||
class nsIArena : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IARENA_IID)
|
||||
|
||||
NS_IMETHOD Init(PRUint32 arenaBlockSize) = 0;
|
||||
|
||||
NS_IMETHOD_(void*) Alloc(PRUint32 size) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a new arena using the desired block size for allocating the
|
||||
* underlying memory blocks. The underlying memory blocks are allocated
|
||||
* using the PR heap.
|
||||
*/
|
||||
extern NS_COM nsresult NS_NewHeapArena(nsIArena** aInstancePtrResult,
|
||||
PRUint32 aArenaBlockSize = 0);
|
||||
|
||||
#define NS_ARENA_CID \
|
||||
{ /* 9832ec80-0d6b-11d3-9331-00104ba0fd40 */ \
|
||||
0x9832ec80, \
|
||||
0x0d6b, \
|
||||
0x11d3, \
|
||||
{0x93, 0x31, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
#endif /* nsIArena_h___ */
|
||||
|
||||
|
||||
@ -51,11 +51,6 @@ static NS_DEFINE_CID(kObserverCID, NS_OBSERVER_CID);
|
||||
|
||||
NS_IMPL_AGGREGATED(nsObserver)
|
||||
|
||||
NS_COM nsresult NS_NewObserver(nsIObserver** anObserver, nsISupports* outer)
|
||||
{
|
||||
return nsObserver::Create(outer, NS_GET_IID(nsIObserver), (void**)anObserver);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsObserver::Create(nsISupports* outer, const nsIID& aIID, void* *anObserver)
|
||||
{
|
||||
|
||||
@ -68,6 +68,4 @@ private:
|
||||
|
||||
};
|
||||
|
||||
extern NS_COM nsresult NS_NewObserver(nsIObserver** anObserver, nsISupports* outer = NULL);
|
||||
|
||||
#endif /* nsObserver_h___ */
|
||||
|
||||
@ -224,21 +224,6 @@ NS_IMETHODIMP nsSupportsPRBoolImpl::ToString(char **_retval)
|
||||
return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewISupportsPRBool (nsISupportsPRBool ** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER (aResult);
|
||||
nsISupportsPRBool * rval = (nsISupportsPRBool *) (new nsSupportsPRBoolImpl ());
|
||||
|
||||
if (!rval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF (rval);
|
||||
*aResult = rval;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsSupportsPRUint8Impl, nsISupportsPRUint8,
|
||||
|
||||
@ -73,9 +73,6 @@ interface nsIBinaryInputStream : nsIInputStream {
|
||||
|
||||
%{C++
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewBinaryInputStream(nsIBinaryInputStream* *aResult, nsIInputStream* aSrcStream);
|
||||
|
||||
inline nsresult
|
||||
NS_ReadOptionalCString(nsIBinaryInputStream* aStream, nsACString& aResult)
|
||||
{
|
||||
|
||||
@ -79,9 +79,6 @@ interface nsIBinaryOutputStream : nsIOutputStream {
|
||||
|
||||
%{C++
|
||||
|
||||
NS_COM nsresult
|
||||
NS_NewBinaryOutputStream(nsIBinaryOutputStream* *aResult, nsIOutputStream* aDestStream);
|
||||
|
||||
inline nsresult
|
||||
NS_WriteOptionalStringZ(nsIBinaryOutputStream* aStream, const char* aString)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user