diff --git a/mozilla/xpcom/src/MANIFEST b/mozilla/xpcom/src/MANIFEST deleted file mode 100644 index 3ec6005f9cc..00000000000 --- a/mozilla/xpcom/src/MANIFEST +++ /dev/null @@ -1,20 +0,0 @@ -# -# This is a list of local files which get copied to the mozilla:dist directory -# - -nsCom.h -nsAgg.h -nsDebug.h -nsError.h -nsHashtable.h -nsID.h -nsIFactory.h -nsISupports.h -nsIPtr.h -nsIServiceManager.h -nsISupportsArray.h -nsRepository.h -nsIEnumerator.h -nsVector.h -nsMacRepository.h -nsTraceRefcnt.h diff --git a/mozilla/xpcom/src/nsAgg.h b/mozilla/xpcom/src/nsAgg.h deleted file mode 100644 index df17193f161..00000000000 --- a/mozilla/xpcom/src/nsAgg.h +++ /dev/null @@ -1,168 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsAgg_h___ -#define nsAgg_h___ - -#include "nsISupports.h" - -/** - * Outer objects can implement nsIOuter if they choose, allowing them to - * get notification if their inner objects (children) are effectively freed. - * This allows them to reset any state associated with the inner object and - * potentially unload it. - */ -class nsIOuter : public nsISupports { -public: - - /** - * This method is called whenever an inner object's refcount is about to - * become zero and the inner object should be released by the outer. This - * allows the outer to clean up any state associated with the inner and - * potentially unload the inner object. This method should call - * inner->Release(). - */ - NS_IMETHOD - ReleaseInner(nsISupports* inner) = 0; - -}; - -#define NS_IOUTER_IID \ -{ /* ea0bf9f0-3d67-11d2-8163-006008119d7a */ \ - 0xea0bf9f0, \ - 0x3d67, \ - 0x11d2, \ - {0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \ -} - -//////////////////////////////////////////////////////////////////////////////// - -// Put this in your class's declaration: -#define NS_DECL_AGGREGATED \ - NS_DECL_ISUPPORTS \ - \ -protected: \ - \ - /* You must implement this operation instead of the nsISupports */ \ - /* methods if you inherit from nsAggregated. */ \ - NS_IMETHOD \ - AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr); \ - \ - class Internal : public nsISupports { \ - public: \ - \ - Internal() {} \ - \ - NS_IMETHOD QueryInterface(const nsIID& aIID, \ - void** aInstancePtr); \ - NS_IMETHOD_(nsrefcnt) AddRef(void); \ - NS_IMETHOD_(nsrefcnt) Release(void); \ - \ - }; \ - \ - friend class Internal; \ - \ - nsISupports* fOuter; \ - Internal fAggregated; \ - \ - nsISupports* GetInner(void) { return &fAggregated; } \ - \ -public: \ - - -// Put this in your class's constructor: -#define NS_INIT_AGGREGATED(outer) \ - NS_INIT_REFCNT(); \ - fOuter = outer; \ - - -// Put this in your class's implementation file: -#define NS_IMPL_AGGREGATED(_class) \ -NS_IMETHODIMP \ -_class::QueryInterface(const nsIID& aIID, void** aInstancePtr) \ -{ \ - /* try our own interfaces first before delegating to outer */ \ - nsresult rslt = AggregatedQueryInterface(aIID, aInstancePtr); \ - if (rslt != NS_OK && fOuter) \ - return fOuter->QueryInterface(aIID, aInstancePtr); \ - else \ - return rslt; \ -} \ - \ -NS_IMETHODIMP_(nsrefcnt) \ -_class::AddRef(void) \ -{ \ - ++mRefCnt; /* keep track of our refcount as well as outer's */ \ - if (fOuter) \ - return NS_ADDREF(fOuter); \ - else \ - return mRefCnt; \ -} \ - \ -NS_IMETHODIMP_(nsrefcnt) \ -_class::Release(void) \ -{ \ - if (fOuter) { \ - nsISupports* outer = fOuter; /* in case we release ourself */ \ - nsIOuter* outerIntf; \ - static NS_DEFINE_IID(kIOuterIID, NS_IOUTER_IID); \ - if (mRefCnt == 1 && \ - outer->QueryInterface(kIOuterIID, \ - (void**)&outerIntf) == NS_OK) { \ - outerIntf->ReleaseInner(GetInner()); \ - outerIntf->Release(); \ - } \ - else \ - --mRefCnt; /* keep track of our refcount as well as outer's */ \ - return outer->Release(); \ - } \ - else { \ - if (--mRefCnt == 0) { \ - delete this; \ - return 0; \ - } \ - return mRefCnt; \ - } \ -} \ - \ -NS_IMETHODIMP \ -_class::Internal::QueryInterface(const nsIID& aIID, void** aInstancePtr) \ -{ \ - _class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \ - return agg->AggregatedQueryInterface(aIID, aInstancePtr); \ -} \ - \ -NS_IMETHODIMP_(nsrefcnt) \ -_class::Internal::AddRef(void) \ -{ \ - _class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \ - return ++agg->mRefCnt; \ -} \ - \ -NS_IMETHODIMP_(nsrefcnt) \ -_class::Internal::Release(void) \ -{ \ - _class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \ - if (--agg->mRefCnt == 0) { \ - delete agg; \ - return 0; \ - } \ - return agg->mRefCnt; \ -} \ - -#endif /* nsAgg_h___ */ diff --git a/mozilla/xpcom/src/nsCom.h b/mozilla/xpcom/src/nsCom.h deleted file mode 100644 index 581f5549d72..00000000000 --- a/mozilla/xpcom/src/nsCom.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsCom_h__ -#define nsCom_h__ - -/* - * API Import/Export macros - */ - -#ifdef _IMPL_NS_COM -#ifdef XP_PC -#define NS_COM _declspec(dllexport) -#else /* !XP_PC */ -#define NS_COM -#endif /* !XP_PC */ -#else /* !_IMPL_NS_COM */ -#ifdef XP_PC -#define NS_COM _declspec(dllimport) -#else /* !XP_PC */ -#define NS_COM -#endif /* !XP_PC */ -#endif /* !_IMPL_NS_COM */ - -/* - * DLL Export macro - */ - -#if defined(XP_PC) - -#define NS_EXPORT _declspec(dllexport) -#define NS_EXPORT_(type) _declspec(dllexport) type __stdcall - -#define NS_IMETHOD_(type) virtual type __stdcall -#define NS_IMETHOD virtual nsresult __stdcall -#define NS_IMETHODIMP_(type) type __stdcall -#define NS_IMETHODIMP nsresult __stdcall - -#define NS_METHOD_(type) type __stdcall -#define NS_METHOD nsresult __stdcall - -#elif defined(XP_MAC) - -#define NS_EXPORT __declspec(export) -#define NS_EXPORT_(type) __declspec(export) type - -#define NS_IMETHOD_(type) virtual type -#define NS_IMETHOD virtual nsresult -#define NS_IMETHODIMP_(type) type -#define NS_IMETHODIMP nsresult - -#define NS_METHOD_(type) type -#define NS_METHOD nsresult - -#else /* !XP_PC && !XP_MAC */ - -#define NS_EXPORT -#define NS_EXPORT_(type) type - -#define NS_IMETHOD_(type) virtual type -#define NS_IMETHOD virtual nsresult -#define NS_IMETHODIMP_(type) type -#define NS_IMETHODIMP nsresult - -#define NS_METHOD_(type) type -#define NS_METHOD nsresult - -#endif /* !XP_PC */ - -#endif - - diff --git a/mozilla/xpcom/src/nsDebug.h b/mozilla/xpcom/src/nsDebug.h deleted file mode 100644 index e97bb4941af..00000000000 --- a/mozilla/xpcom/src/nsDebug.h +++ /dev/null @@ -1,179 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsDebug_h___ -#define nsDebug_h___ - -#include "nsCom.h" -#include "prtypes.h" - -#ifdef DEBUG -#define NS_DEBUG -#endif - -/** - * Namespace for debugging methods. Note that your code must use the - * macros defined later in this file so that the debug code can be - * conditionally compiled out. - */ -class nsDebug { -public: - // XXX add in log controls here - // XXX probably want printf type arguments - - /** - * Abort the executing program. This works on all architectures. - */ - static NS_COM void Abort(const char* aFile, PRIntn aLine); - - /** - * Break the executing program into the debugger. - */ - static NS_COM void Break(const char* aFile, PRIntn aLine); - - /** - * Log a pre-condition message to the debug log - */ - static NS_COM void PreCondition(const char* aStr, const char* aExpr, - const char* aFile, PRIntn aLine); - - /** - * Log a post-condition message to the debug log - */ - static NS_COM void PostCondition(const char* aStr, const char* aExpr, - const char* aFile, PRIntn aLine); - - /** - * Log an assertion message to the debug log - */ - static NS_COM void Assertion(const char* aStr, const char* aExpr, - const char* aFile, PRIntn aLine); - - /** - * Log a not-yet-implemented message to the debug log - */ - static NS_COM void NotYetImplemented(const char* aMessage, - const char* aFile, PRIntn aLine); - - /** - * Log a not-reached message to the debug log - */ - static NS_COM void NotReached(const char* aMessage, - const char* aFile, PRIntn aLine); - - /** - * Log an error message to the debug log. This call returns. - */ - static NS_COM void Error(const char* aMessage, - const char* aFile, PRIntn aLine); - - /** - * Log a warning message to the debug log. - */ - static NS_COM void Warning(const char* aMessage, - const char* aFile, PRIntn aLine); -}; - -#ifdef NS_DEBUG -/** - * Test a precondition for truth. If the expression is not true then - * trigger a program failure. - */ -#define NS_PRECONDITION(expr,str) \ -if (!(expr)) \ - nsDebug::PreCondition(str, #expr, __FILE__, __LINE__) - -/** - * Test an assertion for truth. If the expression is not true then - * trigger a program failure. - */ -#define NS_ASSERTION(expr,str) \ -if (!(expr)) \ - nsDebug::Assertion(str, #expr, __FILE__, __LINE__) - -/** - * Test an assertion for truth. If the expression is not true then - * trigger a program failure. The expression will still be - * executed in release mode. - */ -#define NS_VERIFY(expr,str) \ -if (!(expr)) \ - nsDebug::Assertion(str, #expr, __FILE__, __LINE__) - -/** - * Test a post-condition for truth. If the expression is not true then - * trigger a program failure. - */ -#define NS_POSTCONDITION(expr,str) \ -if (!(expr)) \ - nsDebug::PostCondition(str, #expr, __FILE__, __LINE__) - -/** - * This macros triggers a program failure if executed. It indicates that - * an attempt was made to execute some unimplimented functionality. - */ -#define NS_NOTYETIMPLEMENTED(str) \ - nsDebug::NotYetImplemented(str, __FILE__, __LINE__) - -/** - * This macros triggers a program failure if executed. It indicates that - * an attempt was made to execute some unimplimented functionality. - */ -#define NS_NOTREACHED(str) \ - nsDebug::NotReached(str, __FILE__, __LINE__) - -/** - * Log an error message. - */ -#define NS_ERROR(str) \ - nsDebug::Error(str, __FILE__, __LINE__) - -/** - * Log a warning message. - */ -#define NS_WARNING(str) \ - nsDebug::Warning(str, __FILE__, __LINE__) - -/** - * Trigger an abort - */ -#define NS_ABORT() \ - nsDebug::Abort(__FILE__, __LINE__) - -/** - * Cause a break - */ -#define NS_BREAK() \ - nsDebug::Break(__FILE__, __LINE__) - -#else /* NS_DEBUG */ - -#define NS_PRECONDITION(expr,str) {} -#define NS_ASSERTION(expr,str) {} -#define NS_VERIFY(expr,str) expr -#define NS_POSTCONDITION(expr,str) {} -#define NS_NOTYETIMPLEMENTED(str) {} -#define NS_NOTREACHED(str) {} -#define NS_ERROR(str) {} -#define NS_WARNING(str) {} -#define NS_ABORT() {} -#define NS_BREAK() {} - -#endif /* ! NS_DEBUG */ - -#endif /* nsDebug_h___ */ diff --git a/mozilla/xpcom/src/nsError.h b/mozilla/xpcom/src/nsError.h deleted file mode 100644 index f4085a0a1f4..00000000000 --- a/mozilla/xpcom/src/nsError.h +++ /dev/null @@ -1,178 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsError_h -#define nsError_h - -#ifndef prtypes_h___ -#include "prtypes.h" -#endif - -/** - * Generic result data type - */ - -typedef PRUint32 nsresult; - -/* - * To add error code to your module, you need to do the following: - * - * 1) Add a module offset code. Add yours to the bottom of the list - * right below this comment, adding 1. - * - * 2) In your module, define a header file which uses one of the - * NE_ERROR_GENERATExxxxxx macros. Some examples below: - * - * #define NS_ERROR_MYMODULE_MYERROR1 NS_ERROR_GENERATE(NS_ERROR_SEVERITY_ERROR,NS_ERROR_MODULE_MYMODULE,1) - * #define NS_ERROR_MYMODULE_MYERROR2 NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_MYMODULE,2) - * #define NS_ERROR_MYMODULE_MYERROR3 NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MYMODULE,3) - * - */ - - -/** - * @name Standard Module Offset Code. Each Module should identify a unique number - * and then all errors associated with that module become offsets from the - * base associated with that module id. There are 16 bits of code bits for - * each module. - */ - -#define NS_ERROR_MODULE_XPCOM 1 -#define NS_ERROR_MODULE_BASE 2 -#define NS_ERROR_MODULE_GFX 3 -#define NS_ERROR_MODULE_WIDGET 4 -#define NS_ERROR_MODULE_CALENDAR 5 -#define NS_ERROR_MODULE_NETWORK 6 -#define NS_ERROR_MODULE_PLUGINS 7 -#define NS_ERROR_MODULE_LAYOUT 8 - -/** - * @name Standard Error Handling Macros - */ - -#define NS_FAILED(_nsresult) ((_nsresult) & 0x80000000) -#define NS_SUCCEEDED(_nsresult) (!((_nsresult) & 0x80000000)) - -/** - * @name Severity Code. This flag identifies the level of warning - */ - -#define NS_ERROR_SEVERITY_SUCCESS 0 -#define NS_ERROR_SEVERITY_ERROR 1 - -/** - * @name Mozilla Code. This flag separates consumers of mozilla code - * from the native platform - */ - -#define NS_ERROR_MODULE_BASE_OFFSET 0x45 - -/** - * @name Standard Error Generating Macros - */ - -#define NS_ERROR_GENERATE(sev,module,code) \ - ((nsresult) (((PRUint32)(sev)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) ) - -#define NS_ERROR_GENERATE_SUCCESS(module,code) \ - ((nsresult) (((PRUint32)(NS_ERROR_SEVERITY_SUCCESS)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) ) - -#define NS_ERROR_GENERATE_FAILURE(module,code) \ - ((nsresult) (((PRUint32)(NS_ERROR_SEVERITY_ERROR)<<31) | ((PRUint32)(module+NS_ERROR_MODULE_BASE_OFFSET)<<16) | ((PRUint32)(code))) ) - -/** - * @name Standard Macros for retrieving error bits - */ - -#if PR_BYTES_PER_INT == 4 -#define NS_IS_ERROR(err) (((nsresult)(err))<0) -#else -#define NS_IS_ERROR(err) (((((PRUint32)(err)) >> 31) & 0x1) == NS_ERROR_SEVERITY_ERROR) -#endif - -#define NS_ERROR_GET_CODE(err) ((err) & 0xffff) -#define NS_ERROR_GET_MODULE(err) (((((err) >> 16) - NS_ERROR_MODULE_BASE_OFFSET) & 0x1fff)) -#define NS_ERROR_GET_SEVERITY(err) (((err) >> 31) & 0x1) - -/** - * @name Standard return values - */ - -/*@{*/ - -/* Standard "it worked" return value */ -#define NS_OK 0 - -/* The backwards COM false */ -#define NS_COMFALSE 1 - -#define NS_ERROR_BASE ((nsresult) 0xC1F30000) - -/* Returned when an instance is not initialized */ -#define NS_ERROR_NOT_INITIALIZED (NS_ERROR_BASE + 1) - -/* Returned when an instance is already initialized */ -#define NS_ERROR_ALREADY_INITIALIZED (NS_ERROR_BASE + 2) - -/* Returned by a not implemented function */ -#define NS_ERROR_NOT_IMPLEMENTED ((nsresult) 0x80004001L) - -/* Returned when a given interface is not supported. */ -#define NS_NOINTERFACE ((nsresult) 0x80004002L) -#define NS_ERROR_NO_INTERFACE NS_NOINTERFACE - -#define NS_ERROR_INVALID_POINTER ((nsresult) 0x80004003L) -#define NS_ERROR_NULL_POINTER NS_ERROR_INVALID_POINTER - -/* Returned when a function aborts */ -#define NS_ERROR_ABORT ((nsresult) 0x80004004L) - -/* Returned when a function fails */ -#define NS_ERROR_FAILURE ((nsresult) 0x80004005L) - -/* Returned when an unexpected error occurs */ -#define NS_ERROR_UNEXPECTED ((nsresult) 0x8000ffffL) - -/* Returned when a memory allocation failes */ -#define NS_ERROR_OUT_OF_MEMORY ((nsresult) 0x8007000eL) - -/* Returned when an illegal value is passed */ -#define NS_ERROR_ILLEGAL_VALUE ((nsresult) 0x80070057L) - -/* Returned when a class doesn't allow aggregation */ -#define NS_ERROR_NO_AGGREGATION ((nsresult) 0x80040110L) - -/* Returned when a class doesn't allow aggregation */ -#define NS_ERROR_NOT_AVAILABLE ((nsresult) 0x80040111L) - -/* Returned when a class is not registered */ -#define NS_ERROR_FACTORY_NOT_REGISTERED ((nsresult) 0x80040154L) - -/* Returned when a dynamically loaded factory couldn't be found */ -#define NS_ERROR_FACTORY_NOT_LOADED ((nsresult) 0x800401f8L) - -/* Returned when a factory doesn't support signatures */ -#define NS_ERROR_FACTORY_NO_SIGNATURE_SUPPORT \ - (NS_ERROR_BASE + 0x101) - -/* Returned when a factory already is registered */ -#define NS_ERROR_FACTORY_EXISTS (NS_ERROR_BASE + 0x100) - -/*@}*/ -#endif - diff --git a/mozilla/xpcom/src/nsHashtable.h b/mozilla/xpcom/src/nsHashtable.h deleted file mode 100644 index 930acadd304..00000000000 --- a/mozilla/xpcom/src/nsHashtable.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsHashtable_h__ -#define nsHashtable_h__ - -#include "plhash.h" -#include "nsCom.h" - -class NS_COM nsHashKey { -protected: - nsHashKey(void); -public: - virtual ~nsHashKey(void); - virtual PRUint32 HashValue(void) const = 0; - virtual PRBool Equals(const nsHashKey *aKey) const = 0; - virtual nsHashKey *Clone(void) const = 0; -}; - -// Enumerator callback function. Use - -typedef PRBool (*nsHashtableEnumFunc)(nsHashKey *aKey, void *aData, void* closure); - -class NS_COM nsHashtable { -private: - // members - PLHashTable *hashtable; - -public: - nsHashtable(PRUint32 aSize = 256); - ~nsHashtable(); - - PRInt32 Count(void) { return hashtable->nentries; } - void *Put(nsHashKey *aKey, void *aData); - void *Get(nsHashKey *aKey); - void *Remove(nsHashKey *aKey); - nsHashtable *Clone(); - void Enumerate(nsHashtableEnumFunc aEnumFunc, void* closure = NULL); -}; - -#endif diff --git a/mozilla/xpcom/src/nsID.h b/mozilla/xpcom/src/nsID.h deleted file mode 100644 index 83238da6747..00000000000 --- a/mozilla/xpcom/src/nsID.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsID_h__ -#define nsID_h__ - -#include "prtypes.h" -#include "string.h" -#include "nsCom.h" - -/** - * A "unique identifier". This is modeled after OSF DCE UUIDs. - */ - -struct nsID { - /** - * @name Indentifier values - */ - - //@{ - PRUint32 m0; - PRUint16 m1; - PRUint16 m2; - PRUint8 m3[8]; - //@} - - /** - * @name Methods - */ - - //@{ - /** - * Equivalency method. Compares this nsID with another. - * @return PR_TRUE if they are the same, PR_FALSE if not. - */ - - inline PRBool Equals(const nsID& other) const { - return (PRBool) - ((((PRUint32*) &m0)[0] == ((PRUint32*) &other.m0)[0]) && - (((PRUint32*) &m0)[1] == ((PRUint32*) &other.m0)[1]) && - (((PRUint32*) &m0)[2] == ((PRUint32*) &other.m0)[2]) && - (((PRUint32*) &m0)[3] == ((PRUint32*) &other.m0)[3])); - } - - /** - * nsID Parsing method. Turns a {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - * string into an nsID - */ - NS_COM PRBool Parse(char *aIDStr); - - /** - * nsID string encoder. Returns an allocated string in - * {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} format. Caller should free string. - */ - NS_COM char* ToString() const; - //@} -}; - -/** - * Declare an ID. If NS_IMPL_IDS is set, a variable _name is declared - * with the given values, otherwise _name is declared as an - * extern variable. - */ - -#ifdef NS_IMPL_IDS -#define NS_DECLARE_ID(_name,m0,m1,m2,m30,m31,m32,m33,m34,m35,m36,m37) \ - extern "C" const nsID _name = {m0,m1,m2,{m30,m31,m32,m33,m34,m35,m36,m37}} -#else -#define NS_DECLARE_ID(_name,m0,m1,m2,m30,m31,m32,m33,m34,m35,m36,m37) \ - extern "C" const nsID _name -#endif - -#endif - diff --git a/mozilla/xpcom/src/nsIEnumerator.h b/mozilla/xpcom/src/nsIEnumerator.h deleted file mode 100644 index 8b5e4f3ddfb..00000000000 --- a/mozilla/xpcom/src/nsIEnumerator.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef __nsIEnumerator_h -#define __nsIEnumerator_h - -#include "nsISupports.h" - -// {646F4FB0-B1F2-11d1-AA29-000000000000} -#define NS_IENUMERATOR_IID \ -{0x646f4fb0, 0xb1f2, 0x11d1, \ - { 0xaa, 0x29, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }; - - -class nsIEnumerator : public nsISupports { -public: - NS_IMETHOD_(nsISupports*) Next() = 0; - NS_IMETHOD_(void) Reset()= 0; -}; - -#endif // __nsIFactory_h - diff --git a/mozilla/xpcom/src/nsIFactory.h b/mozilla/xpcom/src/nsIFactory.h deleted file mode 100644 index 1650cf17550..00000000000 --- a/mozilla/xpcom/src/nsIFactory.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef __nsIFactory_h -#define __nsIFactory_h - -#include "prtypes.h" -#include "nsISupports.h" - -/* - * Datatypes and helper macros - */ - -typedef nsID nsCID; - -// Define an CID -#define NS_DEFINE_CID(_name, _cidspec) \ - const nsCID _name = _cidspec - -#define REFNSCID const nsCID& - -/* - * nsIFactory interface - */ - -// {00000001-0000-0000-c000-000000000046} -#define NS_IFACTORY_IID \ -{ 0x00000001, 0x0000, 0x0000, \ - { 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 } } - -class nsIFactory: public nsISupports { -public: - NS_IMETHOD CreateInstance(nsISupports *aOuter, - REFNSIID aIID, - void **aResult) = 0; - - NS_IMETHOD LockFactory(PRBool aLock) = 0; -}; - -/** - * nsIFactory2 allows passing in a signature token when creating an - * instance. This allows instance recycling. - */ - -// {19997C41-A343-11d1-B665-00805F8A2676} -#define NS_IFACTORY2_IID \ -{ 0x19997c41, 0xa343, 0x11d1, \ - { 0xb6, 0x65, 0x0, 0x80, 0x5f, 0x8a, 0x26, 0x76 } } - -class nsIFactory2: public nsIFactory { -public: - NS_IMETHOD CreateInstance2(nsISupports *aOuter, - REFNSIID aIID, - void *aSignature, - void **aResult) = 0; -}; - -#endif diff --git a/mozilla/xpcom/src/nsIPtr.h b/mozilla/xpcom/src/nsIPtr.h deleted file mode 100644 index d537b00157b..00000000000 --- a/mozilla/xpcom/src/nsIPtr.h +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsIPtr_h___ -#define nsIPtr_h___ - -#include "nsISupports.h" - -/* - * nsIPtr is an "auto-release pointer" class for nsISupports based interfaces - * - * It's intent is to be a "set and forget" pointer to help with managing - * active references to nsISupports bases objects. - * - * The pointer object ensures that the underlying pointer is always - * released whenever the value is changed or when the object leaves scope. - * - * Proper care needs to be taken when assigning pointers to a nsIPtr. - * When asigning from a C pointer (nsISupports*), the pointer presumes - * an active reference and subsumes it. When assigning from another nsIPtr, - * a new reference is established. - * - * There are 3 ways to assign a value to a nsIPtr. - * 1) Direct construction or assignment from a C pointer. - * 2) Direct construction or assignment form another nsIPtr. - * 3) Usage of an "out parameter" method. - * a) AssignRef() releases the underlying pointer and returns a reference to it. - * Useful for pointer reference out paramaters. - * b) AssignPtr() releases the underlying pointer and returns a pointer to it. - * c) Query() releases the underlying pointer and returns a (void**) pointer to it. - * Useful for calls to QueryInterface() - * 4) The SetAddRef() method. This is equivalent to an assignment followed by an AddRef(). - * - * examples: - * - * class It { - * void NS_NewFoo(nsIFoo** aFoo); - * nsIFoo* GetFoo(void); - * void GetBar(nsIBar*& aBar); - * }; - * - * nsIFooPtr foo = it->GetFoo(); - * nsIBarPtr bar; - * - * it->NS_NewFoo(foo.AssignPtr()); - * it->GetBar(bar.AssignRef()); - * it->QueryInterface(kIFooIID, foo.Query()); - * bar.SetAddRef(new Bar()); - * - * Advantages: - * Set and forget. Once a pointer is assigned to a nsIPtr, it is impossible - * to forget to release it. - * Always pre-initialized. You can't forget to initialize the pointer. - * - * Disadvantages: - * Usage of this class doesn't eliminate the need to think about ref counts - * and assign values properly, AddRef'ing as needed. - * The nsIPtr doesn't typecast exactly like a C pointer. In order to achieve - * typecasting, it may be necessary to first cast to a C pointer of the - * underlying type. - * - */ - -#define NS_DEF_PTR(cls) \ -class cls##Ptr { \ -public: \ - cls##Ptr(void) : mPtr(0) {} \ - cls##Ptr(const cls##Ptr& aCopy) : mPtr(aCopy.mPtr) \ - { NS_IF_ADDREF(mPtr); } \ - cls##Ptr(cls* aInterface) : mPtr(aInterface) {} \ - ~cls##Ptr(void) { NS_IF_RELEASE(mPtr); } \ - cls##Ptr& operator=(const cls##Ptr& aCopy) \ - { if(mPtr == aCopy.mPtr) return *this; \ - NS_IF_ADDREF(aCopy.mPtr); \ - NS_IF_RELEASE(mPtr); \ - mPtr = aCopy.mPtr; return *this; } \ - cls##Ptr& operator=(cls* aInterface) \ - { if(mPtr == aInterface) return *this; \ - NS_IF_RELEASE(mPtr); mPtr = aInterface; \ - return *this; } \ - cls##Ptr& operator=(PRInt32 aInt) \ - { NS_IF_RELEASE(mPtr); \ - return *this; } \ - void SetAddRef(cls* aInterface) \ - { if(aInterface == mPtr) return; \ - NS_IF_ADDREF(aInterface); \ - NS_IF_RELEASE(mPtr); mPtr = aInterface; } \ - cls* AddRef(void) { NS_ADDREF(mPtr); return mPtr; } \ - cls* IfAddRef(void) \ - { NS_IF_ADDREF(mPtr); return mPtr; } \ - cls*& AssignRef(void) \ - { NS_IF_RELEASE(mPtr); return mPtr; } \ - cls** AssignPtr(void) \ - { NS_IF_RELEASE(mPtr); return &mPtr; } \ - void** Query(void) \ - { NS_IF_RELEASE(mPtr); return (void**)&mPtr; } \ - PRBool IsNull() const \ - { return PRBool(0 == mPtr); } \ - PRBool IsNotNull() const \ - { return PRBool(0 != mPtr); } \ - PRBool operator==(const cls##Ptr& aCopy) const \ - { return PRBool(mPtr == aCopy.mPtr); } \ - PRBool operator==(cls* aInterface) const \ - { return PRBool(mPtr == aInterface); } \ - PRBool operator!=(const cls##Ptr& aCopy) const \ - { return PRBool(mPtr != aCopy.mPtr); } \ - PRBool operator!=(cls* aInterface) const \ - { return PRBool(mPtr != aInterface); } \ - cls* operator->(void) { return mPtr; } \ - cls& operator*(void) { return *mPtr; } \ - operator cls*(void) { return mPtr; } \ - const cls* operator->(void) const { return mPtr; } \ - const cls& operator*(void) const { return *mPtr; } \ - operator const cls*(void) const { return mPtr; } \ -private: \ - void* operator new(size_t size) { return 0; } \ - void operator delete(void* aPtr) {} \ - cls* mPtr; \ -public: \ -friend inline PRBool operator==(const cls* aInterface, const cls##Ptr& aPtr) \ -{ return PRBool(aInterface == aPtr.mPtr); } \ -friend inline PRBool operator!=(const cls* aInterface, const cls##Ptr& aPtr) \ -{ return PRBool(aInterface != aPtr.mPtr); } \ -} - -#endif // nsIPtr_h___ - diff --git a/mozilla/xpcom/src/nsIServiceManager.h b/mozilla/xpcom/src/nsIServiceManager.h deleted file mode 100644 index fbc396d82c0..00000000000 --- a/mozilla/xpcom/src/nsIServiceManager.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsIServiceManager_h___ -#define nsIServiceManager_h___ - -#include "nsRepository.h" - -class nsIShutdownListener; - -/** - * The nsIServiceManager manager interface provides a means to obtain - * global services in an application. The service manager depends on the - * repository to find and instantiate factories to obtain services. - * - * Users of the service manager must first obtain a pointer to the global - * service manager by calling NS_GetGlobalServiceManager. After that, - * they can request specific services by calling GetService. When they are - * finished with a service the release it by calling ReleaseService (instead - * of releasing the service object directly): - * - * nsICacheManager* cm; - * nsServiceManager::GetService(kCacheManagerCID, kICacheManagerIID, (nsISupports**)&cm); - * - * ... use cm, and then sometime later ... - * - * nsServiceManager::ReleaseService(kCacheManagerCID, cm); - * - * A user of a service may keep references to particular services indefinitely - * and only must call ReleaseService when it shuts down. However if the user - * wishes to voluntarily cooperate with the shutdown of the service it is - * using, it may supply an nsIShutdownListener to provide for asynchronous - * release of the services it is using. The shutdown listener's OnShutdown - * method will be called for a service that is being shut down, and it is - * its responsiblity to release references obtained from that service if at - * all possible. - * - * The process of shutting down a particular service is initiated by calling - * the service manager's ShutdownService method. This will iterate through - * all the registered shutdown listeners for the service being shut down, and - * then will attempt to unload the library associated with the service if - * possible. The status result of ShutdownService indicates whether the - * service was successfully shut down, failed, or was not in service. - * - * XXX QUESTIONS: - * - Should a "service" be more than nsISupports? Should it be a factory - * and/or have Startup(), Shutdown(), etc. - * - If the asynchronous OnShutdown operation gets called, does the user - * of a service still need to call ReleaseService? (Or should they _not_ - * call it?) - */ -class nsIServiceManager : public nsISupports { -public: - - NS_IMETHOD - GetService(const nsCID& aClass, const nsIID& aIID, - nsISupports* *result, - nsIShutdownListener* shutdownListener = NULL) = 0; - - NS_IMETHOD - ReleaseService(const nsCID& aClass, nsISupports* service, - nsIShutdownListener* shutdownListener = NULL) = 0; - - /** - * Requests a service to be shut down, possibly unloading its DLL. - * - * @returns NS_OK - if shutdown was successful and service was unloaded, - * @returns NS_ERROR_SERVICE_NOT_FOUND - if shutdown failed because - * the service was not currently loaded - * @returns NS_ERROR_SERVICE_IN_USE - if shutdown failed because some - * user of the service wouldn't voluntarily release it by using - * a shutdown listener. - */ - NS_IMETHOD - ShutdownService(const nsCID& aClass) = 0; - -}; - -#define NS_ISERVICEMANAGER_IID \ -{ /* cf0df3b0-3401-11d2-8163-006008119d7a */ \ - 0xcf0df3b0, \ - 0x3401, \ - 0x11d2, \ - {0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \ -} - -#define NS_ERROR_SERVICE_NOT_FOUND NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 22) -#define NS_ERROR_SERVICE_IN_USE NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 23) - -//////////////////////////////////////////////////////////////////////////////// - -class nsIShutdownListener : public nsISupports { -public: - - NS_IMETHOD - OnShutdown(const nsCID& aClass, nsISupports* service) = 0; - -}; - -#define NS_ISHUTDOWNLISTENER_IID \ -{ /* 56decae0-3406-11d2-8163-006008119d7a */ \ - 0x56decae0, \ - 0x3406, \ - 0x11d2, \ - {0x81, 0x63, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \ -} - -//////////////////////////////////////////////////////////////////////////////// -// Interface to Global Services - -class NS_COM nsServiceManager { -public: - static nsresult GetService(const nsCID& aClass, const nsIID& aIID, - nsISupports* *result, - nsIShutdownListener* shutdownListener = NULL); - - static nsresult ReleaseService(const nsCID& aClass, nsISupports* service, - nsIShutdownListener* shutdownListener = NULL); - - static nsresult ShutdownService(const nsCID& aClass); - -protected: - static nsresult GetGlobalServiceManager(nsIServiceManager* *result); - - static nsIServiceManager* globalServiceManager; - -}; - -//////////////////////////////////////////////////////////////////////////////// - -#endif /* nsIServiceManager_h___ */ diff --git a/mozilla/xpcom/src/nsISupports.h b/mozilla/xpcom/src/nsISupports.h deleted file mode 100644 index 42d553224ed..00000000000 --- a/mozilla/xpcom/src/nsISupports.h +++ /dev/null @@ -1,542 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsISupports_h___ -#define nsISupports_h___ - -#include "nsDebug.h" -#include "nsTraceRefcnt.h" -#include "nsID.h" -#include "nsError.h" - -#if defined(NS_MT_SUPPORTED) -#include "prcmon.h" -#endif /* NS_MT_SUPPORTED */ - -/*@{*/ - -/** - * An "interface id" which can be used to uniquely identify a given - * interface. - */ - -typedef nsID nsIID; - -/** - * A macro shorthand for const nsIID& - */ - -#define REFNSIID const nsIID& - -/** - * Define an IID (obsolete) - */ - -#define NS_DEFINE_IID(_name, _iidspec) \ - const nsIID _name = _iidspec - -//---------------------------------------------------------------------- - -/** - * IID for the nsISupports interface - * {00000000-0000-0000-c000-000000000046} - * - * NOTE: NEVER EVER EVER EVER EVER change this IID. Never. Not once. - * No. Don't do it. Stop! - */ -#define NS_ISUPPORTS_IID \ -{ 0x00000000, 0x0000, 0x0000, \ - {0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} } - -/** - * Reference count values - */ -typedef PRUint32 nsrefcnt; - -/** - * Basic component object model interface. Objects which implement - * this interface support runtime interface discovery (QueryInterface) - * and a reference counted memory model (AddRef/Release). This is - * modelled after the win32 IUnknown API. - */ -class nsISupports { -public: - /** - * @name Methods - */ - - //@{ - /** - * A run time mechanism for interface discovery. - * @param aIID [in] A requested interface IID - * @param aInstancePtr [out] A pointer to an interface pointer to - * receive the result. - * @return NS_OK if the interface is supported by the associated - * instance, NS_NOINTERFACE if it is not. - * NS_ERROR_INVALID_POINTER if aInstancePtr is NULL. - */ - NS_IMETHOD QueryInterface(REFNSIID aIID, - void** aInstancePtr) = 0; - /** - * Increases the reference count for this interface. - * The associated instance will not be deleted unless - * the reference count is returned to zero. - * - * @return The resulting reference count. - */ - NS_IMETHOD_(nsrefcnt) AddRef(void) = 0; - - /** - * Decreases the reference count for this interface. - * Generally, if the reference count returns to zero, - * the associated instance is deleted. - * - * @return The resulting reference count. - */ - NS_IMETHOD_(nsrefcnt) Release(void) = 0; - //@} -}; - -//---------------------------------------------------------------------- - -/** - * Some convenience macros for implementing AddRef and Release - */ - -/** - * Declare the reference count variable and the implementations of the - * AddRef and QueryInterface methods. - */ -#define NS_DECL_ISUPPORTS \ -public: \ - NS_IMETHOD QueryInterface(REFNSIID aIID, \ - void** aInstancePtr); \ - NS_IMETHOD_(nsrefcnt) AddRef(void); \ - NS_IMETHOD_(nsrefcnt) Release(void); \ -protected: \ - nsrefcnt mRefCnt; \ -public: - -/** - * Initialize the reference count variable. Add this to each and every - * constructor you implement. - */ -#define NS_INIT_REFCNT() mRefCnt = 0 - -/** - * Use this macro to implement the AddRef method for a given _class - * @param _class The name of the class implementing the method - */ -#define NS_IMPL_ADDREF(_class) \ -nsrefcnt _class::AddRef(void) \ -{ \ - return ++mRefCnt; \ -} - -/** - * Macro for instantiating a new object that implements nsISupports. - * Use this in your factory methods to allow for refcnt tracing. - * Note that you can only use this if you adhere to the no arguments - * constructor com policy (which you really should!). - * @param _result Where the new instance pointer is stored - * @param _type The type of object to call "new" with. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_NEWXPCOM(_result,_type) \ - _result = new _type(); \ - nsTraceRefcnt::Create(_result, #_type, __FILE__, __LINE__) -#else -#define NS_NEWXPCOM(_result,_type) \ - _result = new _type() -#endif - -/** - * Macro for deleting an object that implements nsISupports. - * Use this in your Release methods to allow for refcnt tracing. - * @param _ptr The object to delete. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_DELETEXPCOM(_ptr) \ - nsTraceRefcnt::Destroy(_ptr, __FILE__, __LINE__); \ - delete _ptr -#else -#define NS_DELETEXPCOM(_ptr) \ - delete _ptr -#endif - -/** - * Macro for adding a reference to an interface. - * @param _ptr The interface pointer. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_ADDREF(_ptr) \ - ((nsrefcnt) nsTraceRefcnt::AddRef((_ptr), (_ptr)->AddRef(), \ - __FILE__, __LINE__)) -#else -#define NS_ADDREF(_ptr) \ - (_ptr)->AddRef() -#endif - -/** - * Macro for adding a reference to this. This macro should be used - * because NS_ADDREF (when tracing) may require an ambiguous cast - * from the pointers primary type to nsISupports. This macro sidesteps - * that entire problem. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_ADDREF_THIS() \ - ((nsrefcnt) nsTraceRefcnt::AddRef(this, AddRef(), __FILE__, __LINE__)) -#else -#define NS_ADDREF_THIS() \ - AddRef() -#endif - -/** - * Macro for adding a reference to an interface that checks for NULL. - * @param _ptr The interface pointer. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_IF_ADDREF(_ptr) \ - ((0 != (_ptr)) \ - ? ((nsrefcnt) nsTraceRefcnt::AddRef((_ptr), (_ptr)->AddRef(), __FILE__, \ - __LINE__)) \ - : 0) -#else -#define NS_IF_ADDREF(_ptr) \ - ((0 != (_ptr)) ? (_ptr)->AddRef() : 0) -#endif - -/** - * Macro for releasing a reference to an interface. - * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will - * be done before the trace message is logged. If the reference count - * goes to zero and implementation of Release logs a message, the two - * messages will be logged out of order. - * - * @param _ptr The interface pointer. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_RELEASE(_ptr) \ - nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), __FILE__, __LINE__); \ - (_ptr) = NULL -#else -#define NS_RELEASE(_ptr) \ - (_ptr)->Release(); \ - (_ptr) = NULL -#endif - -/** - * Macro for releasing a reference to an interface, except that this - * macro preserves the return value from the underlying Release call. - * The interface pointer argument will only be NULLed if the reference count - * goes to zero. - * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will - * be done before the trace message is logged. If the reference count - * goes to zero and implementation of Release logs a message, the two - * messages will be logged out of order. - * - * @param _ptr The interface pointer. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_RELEASE2(_ptr, _result) \ - _result = ((nsrefcnt) nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), \ - __FILE__, __LINE__)); \ - if (0 == (_result)) (_ptr) = NULL -#else -#define NS_RELEASE2(_ptr, _result) \ - _result = (_ptr)->Release(); \ - if (0 == (_result)) (_ptr) = NULL - -#endif - -/** - * Macro for releasing a reference to an interface that checks for NULL; - * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will - * be done before the trace message is logged. If the reference count - * goes to zero and implementation of Release logs a message, the two - * messages will be logged out of order. - * - * @param _ptr The interface pointer. - */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_IF_RELEASE(_ptr) \ - ((0 != (_ptr)) \ - ? ((nsrefcnt) nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), \ - __FILE__, __LINE__)) \ - : 0); \ - (_ptr) = NULL -#else -#define NS_IF_RELEASE(_ptr) \ - ((0 != (_ptr)) ? (_ptr)->Release() : 0); \ - (_ptr) = NULL -#endif - -/** - * Use this macro to implement the Release method for a given _class - * @param _class The name of the class implementing the method - */ -#define NS_IMPL_RELEASE(_class) \ -nsrefcnt _class::Release(void) \ -{ \ - NS_PRECONDITION(0 != mRefCnt, "dup release"); \ - if (--mRefCnt == 0) { \ - NS_DELETEXPCOM(this); \ - return 0; \ - } \ - return mRefCnt; \ -} - -//---------------------------------------------------------------------- - -/* - * Some convenience macros for implementing QueryInterface - */ - -/** - * This implements query interface with two assumptions: First, the - * class in question implements nsISupports and it's own interface and - * nothing else. Second, the implementation of the class's primary - * inheritance chain leads to it's own interface. - * - * @param _class The name of the class implementing the method - * @param _classiiddef The name of the #define symbol that defines the IID - * for the class (e.g. NS_ISUPPORTS_IID) - */ - -#define NS_IMPL_QUERY_INTERFACE(_class,_classiiddef) \ -nsresult _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ -{ \ - if (NULL == aInstancePtr) { \ - return NS_ERROR_NULL_POINTER; \ - } \ - \ - *aInstancePtr = NULL; \ - \ - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); \ - static NS_DEFINE_IID(kClassIID, _classiiddef); \ - if (aIID.Equals(kClassIID)) { \ - *aInstancePtr = (void*) this; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } \ - if (aIID.Equals(kISupportsIID)) { \ - *aInstancePtr = (void*) ((nsISupports*)this); \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } \ - return NS_NOINTERFACE; \ -} - -/** - * Convenience macro for implementing all nsISupports methods for - * a simple class. - * @param _class The name of the class implementing the method - * @param _classiiddef The name of the #define symbol that defines the IID - * for the class (e.g. NS_ISUPPORTS_IID) - */ - -#define NS_IMPL_ISUPPORTS(_class,_classiiddef) \ - NS_IMPL_ADDREF(_class) \ - NS_IMPL_RELEASE(_class) \ - NS_IMPL_QUERY_INTERFACE(_class,_classiiddef) - - -/** - * - * Threadsafe implementations of the ISupports convenience macros - * - */ - -/** - * IID for the nsIsThreadsafe interface - * {88210890-47a6-11d2-bec3-00805f8a66dc} - * - * This interface is *only* used for debugging purposes to determine if - * a given component is threadsafe. - */ -#define NS_ISTHREADSAFE_IID \ -{ 0x88210890, 0x47a6, 0x11d2, \ - {0xbe, 0xc3, 0x00, 0x80, 0x5f, 0x8a, 0x66, 0xdc} } - -#if defined(NS_MT_SUPPORTED) - -#define NS_LOCK_INSTANCE() \ - PR_CEnterMonitor((void*)this) - -#define NS_UNLOCK_INSTANCE() \ - PR_CExitMonitor((void*)this) - -/** - * Use this macro to implement the AddRef method for a given _class - * @param _class The name of the class implementing the method - */ -#if defined(XP_PC) -#define NS_IMPL_THREADSAFE_ADDREF(_class) \ -nsrefcnt _class::AddRef(void) \ -{ \ - return InterlockedIncrement((LONG*)&mRefCnt); \ -} - -#else /* ! XP_PC */ -#define NS_IMPL_THREADSAFE_ADDREF(_class) \ -nsrefcnt _class::AddRef(void) \ -{ \ - nsrefcnt count; \ - NS_LOCK_INSTANCE(); \ - count = ++mRefCnt; \ - NS_UNLOCK_INSTANCE(); \ - return count; \ -} -#endif /* ! XP_PC */ - -/** - * Use this macro to implement the Release method for a given _class - * @param _class The name of the class implementing the method - */ -#if defined(XP_PC) -#define NS_IMPL_THREADSAFE_RELEASE(_class) \ -nsrefcnt _class::Release(void) \ -{ \ - NS_PRECONDITION(0 != mRefCnt, "dup release"); \ - if (0 == InterlockedDecrement((LONG*)&mRefCnt)) { \ - NS_DELETEXPCOM(this); \ - return 0; \ - } \ - return mRefCnt; /* Not threadsafe but who cares. */ \ -} - -#else /* ! XP_PC */ -#define NS_IMPL_THREADSAFE_RELEASE(_class) \ -nsrefcnt _class::Release(void) \ -{ \ - nsrefcnt count; \ - NS_PRECONDITION(0 != mRefCnt, "dup release"); \ - NS_LOCK_INSTANCE(); \ - count = --mRefCnt; \ - NS_UNLOCK_INSTANCE(); \ - if (0 == count) { \ - NS_DELETEXPCOM(this); \ - return 0; \ - } \ - return count; \ -} -#endif /* ! XP_PC */ - -//---------------------------------------------------------------------- - -/* - * Some convenience macros for implementing QueryInterface - */ - -/** - * This implements query interface with two assumptions: First, the - * class in question implements nsISupports and it's own interface and - * nothing else. Second, the implementation of the class's primary - * inheritance chain leads to it's own interface. - * - * @param _class The name of the class implementing the method - * @param _classiiddef The name of the #define symbol that defines the IID - * for the class (e.g. NS_ISUPPORTS_IID) - */ -#if defined(NS_DEBUG) -#define NS_VERIFY_THREADSAFE_INTERFACE(_iface) \ - if (NULL != (_iface)) { \ - nsISupports* tmp; \ - static NS_DEFINE_IID(kIsThreadsafeIID, NS_ISTHREADSAFE_IID); \ - NS_PRECONDITION((NS_OK == _iface->QueryInterface(kIsThreadsafeIID, \ - (void**)&tmp)), \ - "Interface is not threadsafe"); \ - } - -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \ -nsresult _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ -{ \ - if (NULL == aInstancePtr) { \ - return NS_ERROR_NULL_POINTER; \ - } \ - \ - *aInstancePtr = NULL; \ - \ - static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); \ - static NS_DEFINE_IID(kIsThreadsafeIID, NS_ISTHREADSAFE_IID); \ - static NS_DEFINE_IID(kClassIID, _classiiddef); \ - if (aIID.Equals(kClassIID)) { \ - *aInstancePtr = (void*) this; \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } \ - if (aIID.Equals(kISupportsIID)) { \ - *aInstancePtr = (void*) ((nsISupports*)this); \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } \ - if (aIID.Equals(kIsThreadsafeIID)) { \ - return NS_OK; \ - } \ - return NS_NOINTERFACE; \ -} - -#else /* !NS_DEBUG */ - -#define NS_VERIFY_THREADSAFE_INTERFACE(_iface) -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \ - NS_IMPL_QUERY_INTERFACE(_class, _classiiddef) - -#endif /* !NS_DEBUG */ - -/** - * Convenience macro for implementing all nsISupports methods for - * a simple class. - * @param _class The name of the class implementing the method - * @param _classiiddef The name of the #define symbol that defines the IID - * for the class (e.g. NS_ISUPPORTS_IID) - */ - -#define NS_IMPL_THREADSAFE_ISUPPORTS(_class,_classiiddef) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) - -#else /* !NS_MT_SUPPORTED */ - -#define NS_LOCK_INSTANCE() - -#define NS_UNLOCK_INSTANCE() - -#define NS_IMPL_THREADSAFE_ADDREF(_class) NS_IMPL_ADDREF(_class) - -#define NS_IMPL_THREADSAFE_RELEASE(_class) NS_IMPL_RELEASE(_class) - -#define NS_VERIFY_THREADSAFE_INTERFACE(_iface) - -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \ - NS_IMPL_QUERY_INTERFACE(_class, _classiiddef) - -#define NS_IMPL_THREADSAFE_ISUPPORTS(_class,_classiiddef) \ - NS_IMPL_ADDREF(_class) \ - NS_IMPL_RELEASE(_class) \ - NS_IMPL_QUERY_INTERFACE(_class,_classiiddef) - -#endif /* !NS_MT_SUPPORTED */ - -/*@}*/ - -#endif /* nsISupports_h___ */ diff --git a/mozilla/xpcom/src/nsISupportsArray.h b/mozilla/xpcom/src/nsISupportsArray.h deleted file mode 100644 index a5ec9e0b0ee..00000000000 --- a/mozilla/xpcom/src/nsISupportsArray.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsISupportsArray_h___ -#define nsISupportsArray_h___ - -#include "nsCom.h" -#include "nsISupports.h" - -// {791eafa0-b9e6-11d1-8031-006008159b5a} -#define NS_ISUPPORTSARRAY_IID \ -{0x791eafa0, 0xb9e6, 0x11d1, \ - {0x80, 0x31, 0x00, 0x60, 0x08, 0x15, 0x9b, 0x5a}} - -// Enumerator callback function. Return PR_FALSE to stop -typedef PRBool (*nsISupportsArrayEnumFunc)(nsISupports* aElement, void *aData); - -class nsISupportsArray : public nsISupports { -public: - NS_IMETHOD_(nsISupportsArray&) operator=(const nsISupportsArray& other) = 0; - NS_IMETHOD_(PRBool) operator==(const nsISupportsArray& other) const = 0; - NS_IMETHOD_(PRBool) Equals(const nsISupportsArray* other) const = 0; - - NS_IMETHOD_(PRInt32) Count(void) const = 0; - - NS_IMETHOD_(nsISupports*) ElementAt(PRInt32 aIndex) const = 0; - NS_IMETHOD_(nsISupports*) operator[](PRInt32 aIndex) const = 0; - - NS_IMETHOD_(PRInt32) IndexOf(const nsISupports* aPossibleElement, PRInt32 aStartIndex = 0) const = 0; - NS_IMETHOD_(PRInt32) LastIndexOf(const nsISupports* aPossibleElement) const = 0; - - NS_IMETHOD_(PRBool) InsertElementAt(nsISupports* aElement, PRInt32 aIndex) = 0; - - NS_IMETHOD_(PRBool) ReplaceElementAt(nsISupports* aElement, PRInt32 aIndex) = 0; - - NS_IMETHOD_(PRBool) AppendElement(nsISupports* aElement) = 0; - - NS_IMETHOD_(PRBool) RemoveElementAt(PRInt32 aIndex) = 0; - NS_IMETHOD_(PRBool) RemoveElement(const nsISupports* aElement, PRInt32 aStartIndex = 0) = 0; - NS_IMETHOD_(PRBool) RemoveLastElement(const nsISupports* aElement) = 0; - NS_IMETHOD_(void) Clear(void) = 0; - - NS_IMETHOD_(void) Compact(void) = 0; - - NS_IMETHOD_(PRBool) EnumerateForwards(nsISupportsArrayEnumFunc aFunc, void* aData) = 0; - NS_IMETHOD_(PRBool) EnumerateBackwards(nsISupportsArrayEnumFunc aFunc, void* aData) = 0; - -private: - // Copy constructors are not allowed -// XXX test wether this has to be here nsISupportsArray(const nsISupportsArray& other); -}; - -extern NS_COM nsresult - NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult); - - -#endif // nsISupportsArray_h___ diff --git a/mozilla/xpcom/src/nsMacRepository.h b/mozilla/xpcom/src/nsMacRepository.h deleted file mode 100644 index 9402a055cad..00000000000 --- a/mozilla/xpcom/src/nsMacRepository.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ -#ifdef XP_MAC -#ifdef MOZ_NGLAYOUT - -// The Mac NGLayout is not based on shared libraries yet. -// All the DLLs are built as static libraries and we present them as -// shared libraries by redefining PR_LoadLibrary(), PR_UnloadLibrary() -// and PR_FindSymbol() below. -// -// If you add or remove shared libraries on other platforms, you must -// - Add the library name to the defines below. -// - Rename the "NSGetFactory" and "NSCanUnload" procs for the Mac: -// just append the library name to the function name. -// - Add the library and its procs to the static list below. - - -typedef struct MacLibrary -{ - char * name; - nsFactoryProc factoryProc; - nsCanUnloadProc unloadProc; -} MacLibrary; - -// library names -#define WIDGET_DLL "WIDGET_DLL" -#define GFXWIN_DLL "GFXWIN_DLL" -#define VIEW_DLL "VIEW_DLL" -#define WEB_DLL "WEB_DLL" -#define PLUGIN_DLL "PLUGIN_DLL" -#define PREF_DLL "PREF_DLL" -#define PARSER_DLL "PARSER_DLL" -#define DOM_DLL "DOM_DLL" -#define LAYOUT_DLL "LAYOUT_DLL" -#define NETLIB_DLL "NETLIB_DLL" - -#ifdef IMPL_MAC_REPOSITORY - -extern "C" nsresult NSGetFactory_WIDGET_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_GFXWIN_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_VIEW_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_WEB_DLL(const nsCID &, nsIFactory **); -//extern "C" nsresult NSGetFactory_PLUGIN_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_PREF_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_PARSER_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_DOM_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_LAYOUT_DLL(const nsCID &, nsIFactory **); -extern "C" nsresult NSGetFactory_NETLIB_DLL(const nsCID &, nsIFactory **); - -extern "C" PRBool NSCanUnload_PREF_DLL(void); - -// library list -static MacLibrary libraries[] = { - WIDGET_DLL, NSGetFactory_WIDGET_DLL, NULL, - GFXWIN_DLL, NSGetFactory_GFXWIN_DLL, NULL, - VIEW_DLL, NSGetFactory_VIEW_DLL, NULL, - WEB_DLL, NSGetFactory_WEB_DLL, NULL, - //PLUGIN_DLL, NSGetFactory_PLUGIN_DLL, NULL, - PREF_DLL, NSGetFactory_PREF_DLL, NSCanUnload_PREF_DLL, - PARSER_DLL, NSGetFactory_PARSER_DLL, NULL, - DOM_DLL, NSGetFactory_DOM_DLL, NULL, - LAYOUT_DLL, NSGetFactory_LAYOUT_DLL, NULL, - NETLIB_DLL, NSGetFactory_NETLIB_DLL, NULL, - NULL}; - -static void* FindMacSymbol(char* libName, const char *symbolName) -{ - MacLibrary * macLib; - - for (macLib = libraries; ; macLib ++) - { - if (macLib->name == NULL) - return NULL; - - if (PL_strcmp(macLib->name, libName) == 0) - break; - } - - if (PL_strcmp(symbolName, "NSGetFactory") == 0) { - return macLib->factoryProc; - } - else if (PL_strcmp(symbolName, "NSCanUnload") == 0) { - return macLib->unloadProc; - } - return NULL; -} - -#define PR_LoadLibrary(libName) (PRLibrary *)libName -#define PR_UnloadLibrary(lib) lib = NULL -#define PR_FindSymbol(lib, symbolName) FindMacSymbol((char*)lib, symbolName) - -#endif // IMPL_MAC_REPOSITORY - -#endif // MOZ_NGLAYOUT -#endif // XP_MAC diff --git a/mozilla/xpcom/src/nsRepository.h b/mozilla/xpcom/src/nsRepository.h deleted file mode 100644 index e4c29650a7c..00000000000 --- a/mozilla/xpcom/src/nsRepository.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef __nsRespository_h -#define __nsRespository_h - -#include "prtypes.h" -#include "prlog.h" -#include "prmon.h" -#include "nsCom.h" -#include "nsID.h" -#include "nsError.h" -#include "nsISupports.h" -#include "nsIFactory.h" -#include "nsHashtable.h" - -/* - * Prototypes for dynamic library export functions - */ - -extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, - nsIFactory **aFactory); -extern "C" NS_EXPORT PRBool NSCanUnload(void); -extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *path); -extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *path); - -/* - * Dynamic library export function types - */ - -typedef nsresult (*nsFactoryProc)(const nsCID &aCLass, - nsIFactory **aFactory); -typedef PRBool (*nsCanUnloadProc)(void); -typedef nsresult (*nsRegisterProc)(const char *path); -typedef nsresult (*nsUnregisterProc)(const char *path); - -/* - * Support types - */ - -class FactoryEntry; - -/* - * nsRepository class - */ - -class NS_COM nsRepository { -private: - static nsHashtable *factories; - static PRMonitor *monitor; - - static nsresult checkInitialized(void); - static nsresult loadFactory(FactoryEntry *aEntry, nsIFactory **aFactory); - -public: - static nsresult Initialize(void); - // Finds a factory for a specific class ID - static nsresult FindFactory(const nsCID &aClass, - nsIFactory **aFactory); - - // Creates a class instance for a specific class ID - static nsresult CreateInstance(const nsCID &aClass, - nsISupports *aDelegate, - const nsIID &aIID, - void **aResult); - - // Creates a class instance for a specific class ID - static nsresult CreateInstance2(const nsCID &aClass, - nsISupports *aDelegate, - const nsIID &aIID, - void *aSignature, - void **aResult); - - // Manually registry a factory for a class - static nsresult RegisterFactory(const nsCID &aClass, - nsIFactory *aFactory, - PRBool aReplace); - - // Manually registry a dynamically loaded factory for a class - static nsresult RegisterFactory(const nsCID &aClass, - const char *aLibrary, - PRBool aReplace, - PRBool aPersist); - - // Manually unregister a factory for a class - static nsresult UnregisterFactory(const nsCID &aClass, - nsIFactory *aFactory); - - // Manually unregister a dynamically loaded factory for a class - static nsresult UnregisterFactory(const nsCID &aClass, - const char *aLibrary); - - // Unload dynamically loaded factories that are not in use - static nsresult FreeLibraries(void); -}; - -#endif diff --git a/mozilla/xpcom/src/nsTraceRefcnt.h b/mozilla/xpcom/src/nsTraceRefcnt.h deleted file mode 100644 index 36b04d031c2..00000000000 --- a/mozilla/xpcom/src/nsTraceRefcnt.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (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 Communicator client code. - * - * The Initial Developer of the Original Code is Netscape Communications - * Corporation. Portions created by Netscape are Copyright (C) 1998 - * Netscape Communications Corporation. All Rights Reserved. - */ -#ifndef nsTraceRefcnt_h___ -#define nsTraceRefcnt_h___ - -#include "nsCom.h" - -/** - * This class is used to support tracing (and logging using nspr) of - * addref and release calls. Note that only calls that use the - * NS_ADDREF and related macros in nsISupports can be traced. - * - * The name of the nspr log module is "xpcomrefcnt" (case matters). - * - * This code only performs tracing built with debugging AND when - * built with -DMOZ_TRACE_XPCOM_REFCNT (because it's expensive!). - */ -class nsTraceRefcnt { -public: - static NS_COM unsigned long AddRef(void* aPtr, - unsigned long aNewRefcnt, - const char* aFile, - int aLine); - - static NS_COM unsigned long Release(void* aPtr, - unsigned long aNewRefcnt, - const char* aFile, - int aLine); - - static NS_COM void Create(void* aPtr, - const char* aType, - const char* aFile, - int aLine); - - static NS_COM void Destroy(void* aPtr, - const char* aFile, - int aLine); - - static NS_COM void LoadLibrarySymbols(const char* aLibraryName, - void* aLibrayHandle); -}; - -#endif /* nsTraceRefcnt_h___ */ diff --git a/mozilla/xpcom/src/nsVector.h b/mozilla/xpcom/src/nsVector.h deleted file mode 100644 index d993691e36e..00000000000 --- a/mozilla/xpcom/src/nsVector.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. - * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. - */ - -#ifndef nsVector_h__ -#define nsVector_h__ - -#include "plvector.h" -#include "nsCom.h" - -class nsVector : public PLVector { -public: -// Construction - nsVector(PRUint32 initialSize = 0, PRInt32 initialGrowBy = 0) { - PL_VectorInitialize(this, initialSize, initialGrowBy); - } - ~nsVector(void) { PL_VectorFinalize(this); } - -// Attributes - PRUint32 GetSize(void) const { return PL_VectorGetSize(this); } - PRUint32 GetUpperBound(void) const { return GetSize() - 1; } - PRBool SetSize(PRUint32 nNewSize, PRInt32 nGrowBy = PL_VECTOR_GROW_DEFAULT) { - return PL_VectorSetSize(this, nNewSize, nGrowBy); - } - PRBool IsValidIndex(PRUint32 index) { return PL_VectorIsValidIndex(this, index); } - -// Operations - // Clean up - void Compact(void) { PL_VectorCompact(this); } - void RemoveAll(void) { SetSize(0); } - void Copy(nsVector* src, PRUint32 len, PRUint32 dstPos = 0, PRUint32 srcPos = 0) { - PL_VectorCopy(this, dstPos, src, srcPos, len); - } - - // Accessing elements - void* Get(PRUint32 index) const { return PL_VectorGet(this, index); } - void Set(PRUint32 index, void* newElement) { PL_VectorSet(this, index, newElement); } - void*& ElementAt(PRUint32 index) { return *PL_VectorGetAddr(this, index); } - - // Potentially growing the array - PRInt32 Add(void* newElement) { return PL_VectorAdd(this, newElement); } - - // overloaded operator helpers - void* operator[](PRUint32 index) const { return Get(index); } - void*& operator[](PRUint32 index) { return ElementAt(index); } - - // Operations that move elements around - void Insert(PRUint32 index, void* newElement, PRInt32 count = 1) { - PL_VectorInsert(this, index, newElement, count); - } - void Remove(PRUint32 index, PRInt32 count = 1) { - PL_VectorRemove(this, index, count); - } - -#ifdef DEBUG - void AssertValid(void) const { PL_VectorAssertValid((PLVector*)this); } -#endif -}; - -#endif