Bug 410326 do_CreateInstanceFromCategory is no longer used. r/sr=benjamin,a1.9=dsicore

This commit is contained in:
bugzilla@standard8.plus.com 2008-01-04 10:08:34 -08:00
Родитель c94b553c68
Коммит 739e711601
2 изменённых файлов: 0 добавлений и 85 удалений

Просмотреть файл

@ -39,51 +39,10 @@
#define nsCategoryManagerUtils_h__
#include "nsICategoryManager.h"
#include "nsCOMPtr.h"
NS_COM nsresult
NS_CreateServicesFromCategory(const char *category,
nsISupports *origin,
const char *observerTopic);
class NS_COM nsCreateInstanceFromCategory : public nsCOMPtr_helper
{
public:
nsCreateInstanceFromCategory(const char *aCategory, const char *aEntry,
nsISupports *aOuter, nsresult *aErrorPtr)
: mCategory(aCategory),
mEntry(aEntry),
mOuter(aOuter),
mErrorPtr(aErrorPtr)
{
// nothing else to do;
}
virtual nsresult NS_FASTCALL operator()( const nsIID& aIID, void** aInstancePtr) const;
private:
const char *mCategory; // Do not free. This char * is not owned.
const char *mEntry; // Do not free. This char * is not owned.
nsISupports *mOuter;
nsresult *mErrorPtr;
};
inline
const nsCreateInstanceFromCategory
do_CreateInstanceFromCategory( const char *aCategory, const char *aEntry,
nsresult *aErrorPtr = 0)
{
return nsCreateInstanceFromCategory(aCategory, aEntry, 0, aErrorPtr);
}
inline
const nsCreateInstanceFromCategory
do_CreateInstanceFromCategory( const char *aCategory, const char *aEntry,
nsISupports *aOuter, nsresult *aErrorPtr = 0)
{
return nsCreateInstanceFromCategory(aCategory, aEntry, aOuter, aErrorPtr);
}
#endif

Просмотреть файл

@ -163,50 +163,6 @@ static void GetIDString(const nsID& aCID, char buf[UID_STRING_LENGTH])
(PRUint32) aCID.m3[6], (PRUint32) aCID.m3[7]);
}
nsresult
nsCreateInstanceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) const
{
/*
* If I were a real man, I would consolidate this with
* nsGetServiceFromContractID::operator().
*/
nsresult rv;
nsXPIDLCString value;
nsCOMPtr<nsIComponentManager> compMgr;
nsCOMPtr<nsICategoryManager> catman =
do_GetService(kCategoryManagerCID, &rv);
if (NS_FAILED(rv)) goto error;
if (!mCategory || !mEntry) {
// when categories have defaults, use that for null mEntry
rv = NS_ERROR_NULL_POINTER;
goto error;
}
/* find the contractID for category.entry */
rv = catman->GetCategoryEntry(mCategory, mEntry,
getter_Copies(value));
if (NS_FAILED(rv)) goto error;
if (!value) {
rv = NS_ERROR_SERVICE_NOT_AVAILABLE;
goto error;
}
NS_GetComponentManager(getter_AddRefs(compMgr));
if (!compMgr)
return NS_ERROR_FAILURE;
rv = compMgr->CreateInstanceByContractID(value, mOuter, aIID, aInstancePtr);
if (NS_FAILED(rv)) {
error:
*aInstancePtr = 0;
}
if (mErrorPtr)
*mErrorPtr = rv;
return rv;
}
nsresult
nsGetServiceFromCategory::operator()(const nsIID& aIID, void** aInstancePtr) const
{