зеркало из https://github.com/mozilla/pjs.git
fix for bug 162115 - add nsCOMArray<T> and nsIArray to the build
r=dougt, sr=darin, lots of comments from brendan, kai, bugmail@sicking.cc, frank.schoenheit@gmx.de, and even a little license help from timeless
This commit is contained in:
Родитель
b603bc3b37
Коммит
36cde0fbc6
|
@ -62,6 +62,13 @@
|
|||
*/
|
||||
#define NS_PROPERTIES_CONTRACTID "@mozilla.org/properties;1"
|
||||
|
||||
/**
|
||||
* XPCOM Array Object ContractID
|
||||
* Simple array implementation which supports the nsIArray and
|
||||
* nsIMutableArray interfaces.
|
||||
*/
|
||||
#define NS_ARRAY_CONTRACTID "@mozilla.org/array;1"
|
||||
|
||||
/**
|
||||
* The following are the CIDs and Contract IDs of the nsISupports wrappers for
|
||||
* primative types.
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "nsByteBuffer.h"
|
||||
|
||||
#include "nsSupportsArray.h"
|
||||
#include "nsArray.h"
|
||||
#include "nsSupportsPrimitives.h"
|
||||
#include "nsConsoleService.h"
|
||||
#include "nsExceptionService.h"
|
||||
|
@ -176,6 +177,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsDoubleImpl)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsVoidImpl)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSupportsInterfacePointerImpl)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsArray);
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsConsoleService);
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAtomService);
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsExceptionService);
|
||||
|
@ -306,6 +308,7 @@ static const nsModuleComponentInfo components[] = {
|
|||
COMPONENT(PERSISTENTPROPERTIES, nsPersistentProperties::Create),
|
||||
|
||||
COMPONENT(SUPPORTSARRAY, nsSupportsArray::Create),
|
||||
COMPONENT(ARRAY, nsArrayConstructor),
|
||||
COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor),
|
||||
COMPONENT(EXCEPTIONSERVICE, nsExceptionServiceConstructor),
|
||||
COMPONENT(ATOMSERVICE, nsAtomServiceConstructor),
|
||||
|
@ -518,7 +521,7 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
|
|||
// clients can create new objects.
|
||||
|
||||
// Registry
|
||||
|
||||
#if 0
|
||||
nsIFactory *registryFactory = NULL;
|
||||
rv = NS_RegistryGetFactory(®istryFactory);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -530,8 +533,8 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
|
|||
NS_REGISTRY_CONTRACTID,
|
||||
registryFactory, PR_TRUE);
|
||||
NS_RELEASE(registryFactory);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
#endif
|
||||
|
||||
// Category Manager
|
||||
{
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
nsArray.h
|
||||
nsArrayEnumerator.h
|
||||
nsAtomService.h
|
||||
nsCppSharedAllocator.h
|
||||
nsCOMArray.h
|
||||
nsCRT.h
|
||||
nsDeque.h
|
||||
nsDoubleHashtable.h
|
||||
|
|
|
@ -11,6 +11,7 @@ nsIRecyclingAllocator.idl
|
|||
nsISerializable.idl
|
||||
nsISimpleEnumerator.idl
|
||||
nsISupportsArray.idl
|
||||
nsIArray.idl
|
||||
nsITimelineService.idl
|
||||
nsISupportsIterators.idl
|
||||
nsISupportsPrimitives.idl
|
||||
|
|
|
@ -72,6 +72,9 @@ CPPSRCS = \
|
|||
nsTextFormatter.cpp \
|
||||
nsTimelineService.cpp \
|
||||
nsValueArray.cpp \
|
||||
nsCOMArray.cpp \
|
||||
nsArray.cpp \
|
||||
nsArrayEnumerator.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
@ -107,6 +110,9 @@ EXPORTS = \
|
|||
plvector.h \
|
||||
nsTextFormatter.h \
|
||||
nsValueArray.h \
|
||||
nsArray.h \
|
||||
nsArrayEnumerator.h \
|
||||
nsCOMArray.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
@ -122,6 +128,7 @@ XPIDLSRCS = \
|
|||
nsISupportsArray.idl \
|
||||
nsISupportsIterators.idl \
|
||||
nsITimelineService.idl \
|
||||
nsIArray.idl \
|
||||
$(NULL)
|
||||
|
||||
SDK_XPIDLSRCS = \
|
||||
|
|
|
@ -110,19 +110,21 @@ nsArray::Enumerate(nsISimpleEnumerator **aResult)
|
|||
NS_IMETHODIMP
|
||||
nsArray::AppendElement(nsISupports* aElement, PRBool aWeak)
|
||||
{
|
||||
nsCOMPtr<nsISupports> elementRef;
|
||||
PRBool result;
|
||||
if (aWeak) {
|
||||
elementRef =
|
||||
nsCOMPtr<nsISupports> elementRef =
|
||||
getter_AddRefs(NS_STATIC_CAST(nsISupports*,
|
||||
NS_GetWeakReference(aElement)));
|
||||
NS_ASSERTION(elementRef, "AppendElement: Trying to use weak references on an object that doesn't support it");
|
||||
if (!elementRef)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
} else {
|
||||
elementRef = aElement;
|
||||
result = mArray.AppendObject(elementRef);
|
||||
}
|
||||
|
||||
else {
|
||||
// add the object directly
|
||||
result = mArray.AppendObject(aElement);
|
||||
}
|
||||
PRBool result = mArray.AppendObject(elementRef);
|
||||
return result ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,8 +87,8 @@ NS_NewArrayEnumerator(nsISimpleEnumerator* *result,
|
|||
nsSimpleArrayEnumerator* enumer = new nsSimpleArrayEnumerator(array);
|
||||
if (enumer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
*result = enumer;
|
||||
NS_ADDREF(*result);
|
||||
|
||||
NS_ADDREF(*result = enumer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,6 @@ NS_NewArrayEnumerator(nsISimpleEnumerator* *aResult,
|
|||
nsCOMArrayEnumerator *enumerator = new (aArray) nsCOMArrayEnumerator();
|
||||
if (!enumerator) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
*aResult = enumerator;
|
||||
NS_ADDREF(*aResult);
|
||||
NS_ADDREF(*aResult = enumerator);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -94,15 +94,15 @@ nsArrayEnumerator::GetNext(nsISupports** aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
extern "C" NS_COM nsresult
|
||||
extern NS_COM nsresult
|
||||
NS_NewArrayEnumerator(nsISimpleEnumerator* *result,
|
||||
nsISupportsArray* array)
|
||||
{
|
||||
nsArrayEnumerator* enumer = new nsArrayEnumerator(array);
|
||||
if (enumer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(enumer);
|
||||
*result = enumer;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -147,8 +147,8 @@ nsSingletonEnumerator::GetNext(nsISupports** aResult)
|
|||
|
||||
mConsumed = PR_TRUE;
|
||||
|
||||
NS_ADDREF(mValue);
|
||||
*aResult = mValue;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -159,8 +159,8 @@ NS_NewSingletonEnumerator(nsISimpleEnumerator* *result,
|
|||
nsSingletonEnumerator* enumer = new nsSingletonEnumerator(singleton);
|
||||
if (enumer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(enumer);
|
||||
*result = enumer;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -247,8 +247,8 @@ NS_NewAdapterEnumerator(nsISimpleEnumerator* *result,
|
|||
nsAdapterEnumerator* enumer = new nsAdapterEnumerator(enumerator);
|
||||
if (enumer == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(enumer);
|
||||
*result = enumer;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
NS_IMETHOD HasMoreElements(PRBool* aResult);
|
||||
NS_IMETHOD GetNext(nsISupports** aResult);
|
||||
|
||||
// nsRDFArrayEnumerator methods
|
||||
// nsArrayEnumerator methods
|
||||
nsArrayEnumerator(nsISupportsArray* aValueArray);
|
||||
virtual ~nsArrayEnumerator(void);
|
||||
|
||||
|
@ -60,7 +60,7 @@ protected:
|
|||
PRInt32 mIndex;
|
||||
};
|
||||
|
||||
extern "C" NS_COM nsresult
|
||||
extern NS_COM nsresult
|
||||
NS_NewArrayEnumerator(nsISimpleEnumerator* *result,
|
||||
nsISupportsArray* array);
|
||||
|
||||
|
|
|
@ -871,6 +871,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIWeakReference.idl</PATH>
|
||||
|
@ -1400,6 +1407,11 @@
|
|||
<PATH>nsISupportsArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIWeakReference.idl</PATH>
|
||||
|
@ -2550,6 +2562,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIWeakReference.idl</PATH>
|
||||
|
@ -3079,6 +3098,11 @@
|
|||
<PATH>nsISupportsArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIWeakReference.idl</PATH>
|
||||
|
@ -3719,6 +3743,12 @@
|
|||
<PATH>nsISupportsArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIArray.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
|
|
@ -1058,6 +1058,27 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsCOMArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArrayEnumerator.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NSPR20.shlb</PATH>
|
||||
|
@ -1937,6 +1958,21 @@
|
|||
<PATH>nsSupportsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsCOMArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArrayEnumerator.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsID.cpp</PATH>
|
||||
|
@ -3539,6 +3575,27 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsCOMArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArrayEnumerator.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>NSPR20Debug.shlb</PATH>
|
||||
|
@ -4430,6 +4487,21 @@
|
|||
<PATH>nsSupportsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsCOMArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArrayEnumerator.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsEventQueueService.cpp</PATH>
|
||||
|
@ -5344,6 +5416,24 @@
|
|||
<PATH>nsSupportsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpcom.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsCOMArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpcom.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArray.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpcom.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsArrayEnumerator.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpcom.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
|
Загрузка…
Ссылка в новой задаче