Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
nsComponentManagerImpl Class Reference

#include <nsComponentManager.h>

Inheritance diagram for nsComponentManagerImpl:
Inheritance graph
[legend]
Collaboration diagram for nsComponentManagerImpl:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR
NS_IMETHOD 
GetClassObjectByContractID (const char *aContractID, const nsIID &aIID, void **_retval)
NS_DECL_NSICOMPONENTMANAGEROBSOLETE
NS_IMETHOD 
AutoRegister (nsIFile *aSpec)
 AutoRegister(RegistrationInstant, const char *directory)
NS_IMETHOD AutoUnregister (nsIFile *aSpec)
NS_IMETHOD RegisterFactory (const nsCID &aClass, const char *aClassName, const char *aContractID, nsIFactory *aFactory)
 RegisterFactory()
NS_IMETHOD RegisterFactoryLocation (const nsCID &aClass, const char *aClassName, const char *aContractID, nsIFile *aFile, const char *loaderStr, const char *aType)
NS_IMETHOD UnregisterFactoryLocation (const nsCID &aClass, nsIFile *aFile)
NS_IMETHOD IsCIDRegistered (const nsCID &aClass, PRBool *_retval)
NS_IMETHOD IsContractIDRegistered (const char *aClass, PRBool *_retval)
NS_IMETHOD EnumerateCIDs (nsISimpleEnumerator **_retval)
NS_IMETHOD EnumerateContractIDs (nsISimpleEnumerator **_retval)
NS_IMETHOD CIDToContractID (const nsCID &aClass, char **_retval)
NS_IMETHOD ContractIDToCID (const char *aContractID, nsCID **_retval)
NS_DECL_NSISERVICEMANAGER
NS_DECL_NSISERVICEMANAGEROBSOLETE
NS_DECL_NSICOMPONENTLOADERMANAGER 
nsComponentManagerImpl ()
nsresult Init (nsStaticModuleInfo const *aStaticModules, PRUint32 aStaticModuleCount)
nsresult WritePersistentRegistry ()
nsresult ReadPersistentRegistry ()
nsresult Shutdown (void)
nsresult FreeServices ()
nsresult NS_GetService (const char *aContractID, const nsIID &aIID, PRBool aDontCreate, nsISupports **result)
nsresult RegisterComponentCommon (const nsCID &aClass, const char *aClassName, const char *aContractID, PRUint32 aContractIDLen, const char *aRegistryName, PRUint32 aRegistryNameLen, PRBool aReplace, PRBool aPersist, const char *aType)
nsresult GetLoaderForType (int aType, nsIComponentLoader **aLoader)
nsresult FindFactory (const char *contractID, PRUint32 aContractIDLen, nsIFactory **aFactory)
 FindFactory()
nsresult LoadFactory (nsFactoryEntry *aEntry, nsIFactory **aFactory)
 LoadFactory()
nsFactoryEntryGetFactoryEntry (const char *aContractID, PRUint32 aContractIDLen)
nsFactoryEntryGetFactoryEntry (const nsCID &aClass)
nsresult SyncComponentsInDir (PRInt32 when, nsIFile *dirSpec)
nsresult SelfRegisterDll (nsDll *dll)
nsresult SelfUnregisterDll (nsDll *dll)
nsresult HashContractID (const char *acontractID, PRUint32 aContractIDLen, nsFactoryEntry *fe_ptr)
void DeleteContractIDEntriesByCID (const nsCID *aClass, const char *registryName)
void DeleteContractIDEntriesByCID (const nsCID *aClass, nsIFactory *factory)
nsresult UnloadLibraries (nsIServiceManager *servmgr, PRInt32 when)
int GetLoaderType (const char *typeStr)
nsresult AddLoaderType (const char *typeStr, int *typeIndex)
int GetLoaderCount ()
nsresult AutoRegisterNonNativeComponents (nsIFile *spec)
nsresult AutoRegisterImpl (PRInt32 when, nsIFile *inDirSpec, PRBool fileIsCompDir=PR_TRUE)
nsresult RemoveEntries (nsIFile *file)
void getClassObject (in nsCIDRef aClass, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
 getClassObject
void getClassObjectByContractID (in string aContractID, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
 getClassObjectByContractID
void createInstance (in nsCIDRef aClass, in nsISupports aDelegate, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
 createInstance
void createInstanceByContractID (in string aContractID, in nsISupports aDelegate, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
 createInstanceByContractID
void getService (in nsCIDRef aClass, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
 getServiceByContractID
void getServiceByContractID (in string aContractID, in nsIIDRef aIID,[iid_is(aIID), retval] out nsQIResult result)
boolean isServiceInstantiated (in nsCIDRef aClass, in nsIIDRef aIID)
 isServiceInstantiated
boolean isServiceInstantiatedByContractID (in string aContractID, in nsIIDRef aIID)
void autoRegister (in nsIFile aSpec)
 autoRegister
void autoUnregister (in nsIFile aSpec)
 autoUnregister
void registerFactory (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFactory aFactory)
 registerFactory
void unregisterFactory (in nsCIDRef aClass, in nsIFactory aFactory)
 unregisterFactory
void registerFactoryLocation (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aFile, in string aLoaderStr, in string aType)
 registerFactoryLocation
void unregisterFactoryLocation (in nsCIDRef aClass, in nsIFile aFile)
 unregisterFactoryLocation
boolean isCIDRegistered (in nsCIDRef aClass)
 isCIDRegistered
boolean isContractIDRegistered (in string aContractID)
 isContractIDRegistered
nsISimpleEnumerator enumerateCIDs ()
 enumerateCIDs
nsISimpleEnumerator enumerateContractIDs ()
 enumerateContractIDs
string CIDToContractID (in nsCIDRef aClass)
 CIDToContractID.
nsCIDPtr contractIDToCID (in string aContractID)
 contractIDToCID
void getInterface (in nsIIDRef uuid,[iid_is(uuid), retval] out nsQIResult result)
 Retrieves the specified interface pointer.
boolean hasFileChanged (in nsIFile file, in string loaderString, in PRInt64 modDate)
void saveFileInfo (in nsIFile file, in string loaderString, in PRInt64 modDate)
void removeFileInfo (in nsIFile file, in string loaderString)
void flushPersistentStore (in boolean now)
string getOptionalData (in nsIFile file, in string loaderString)
void setOptionalData (in nsIFile file, in string loaderString, in string value)
 NS_DEFINE_STATIC_IID_ACCESSOR (NS_ISERVICEMANAGER_OBSOLETE_IID)
NS_IMETHOD RegisterService (const nsCID &aClass, nsISupports *aService)=0
 RegisterService may be called explicitly to register a service with the service manager.
NS_IMETHOD RegisterService (const char *aContractID, nsISupports *aService)=0
NS_IMETHOD UnregisterService (const nsCID &aClass)=0
 Requests a service to be shut down, possibly unloading its DLL.
NS_IMETHOD UnregisterService (const char *aContractID)=0
NS_IMETHOD GetService (const nsCID &aClass, const nsIID &aIID, nsISupports **result, nsIShutdownListener *shutdownListener=nsnull)=0
NS_IMETHOD GetService (const char *aContractID, const nsIID &aIID, nsISupports **result, nsIShutdownListener *shutdownListener=nsnull)=0
NS_IMETHOD ReleaseService (const nsCID &aClass, nsISupports *service, nsIShutdownListener *shutdownListener=nsnull)=0
NS_IMETHOD ReleaseService (const char *aContractID, nsISupports *service, nsIShutdownListener *shutdownListener=nsnull)=0
nsIFactory findFactory (in nsCIDRef aClass)
 findFactory
voidPtr getClassObject (in nsCIDRef aClass, in nsIIDRef aIID)
 getClassObject
nsresult contractIDToClassID (in string aContractID, out nsCID aClass)
 contractIDToClassID
string CLSIDToContractID (in nsCIDRef aClass, out string aClassName)
 classIDToContractid
voidPtr createInstance (in nsCIDRef aClass, in nsISupports aDelegate, in nsIIDRef aIID)
 createInstance
voidPtr createInstanceByContractID (in string aContractID, in nsISupports aDelegate, in nsIIDRef IID)
 createInstanceByContractID
string registryLocationForSpec (in nsIFile aSpec)
 registryLocationForSpec
nsIFile specForRegistryLocation (in string aLocation)
 specForRegistyLocation
void registerFactory (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFactory aFactory, in boolean aReplace)
 registerFactory
void registerComponent (in nsCIDRef aClass, in string aClassName, in string aContractID, in string aLocation, in boolean aReplace, in boolean aPersist)
 registerComponent
void registerComponentWithType (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aSpec, in string aLocation, in boolean aReplace, in boolean aPersist, in string aType)
 registerComponentWithType
void registerComponentSpec (in nsCIDRef aClass, in string aClassName, in string aContractID, in nsIFile aLibrary, in boolean aReplace, in boolean aPersist)
 registerComponentSpec
void registerComponentLib (in nsCIDRef aClass, in string aClassName, in string aContractID, in string aDllName, in boolean aReplace, in boolean aPersist)
 registerComponentLib
void unregisterFactory (in nsCIDRef aClass, in nsIFactory aFactory)
 unregisterFactory
void unregisterComponent (in nsCIDRef aClass, in string aLocation)
 unregisterComponent
void unregisterComponentSpec (in nsCIDRef aClass, in nsIFile aLibrarySpec)
 unregisterComponentSpec
void freeLibraries ()
 freeLibraries
void autoRegister (in long when, in nsIFile directory)
 autoRegister
void autoRegisterComponent (in long when, in nsIFile aFileLocation)
 autoRegisterComponent
void autoUnregisterComponent (in long when, in nsIFile aFileLocation)
 autoUnregisterComponent
boolean isRegistered (in nsCIDRef aClass)
 isRegistered
nsIEnumerator enumerateCLSIDs ()
 enumerateCLSIDs
nsIEnumerator enumerateContractIDs ()
 enumerateContractIDs

Public Attributes

PLDHashTable mFactories
PLDHashTable mContractIDs
PRMonitormMon
nsNativeComponentLoadermNativeComponentLoader
nsIComponentLoadermStaticComponentLoader
nsCOMPtr< nsIFilemComponentsDir
PRInt32 mComponentsOffset
nsCOMPtr< nsIFilemGREComponentsDir
PRInt32 mGREComponentsOffset
nsCOMPtr< nsIFilemRegistryFile
PRUint32 mShuttingDown
nsLoaderdatamLoaderData
int mNLoaderData
int mMaxNLoaderData
PRBool mRegistryDirty
nsHashtable mAutoRegEntries
nsCOMPtr< nsCategoryManagermCategoryManager
PLArenaPool mArena
const long NS_Startup = 0
 ID values for 'when'.
const long NS_Script = 1
const long NS_Timer = 2
const long NS_Shutdown = 3

Static Public Attributes

static nsComponentManagerImplgComponentManager = NULL

Private Member Functions

 ~nsComponentManagerImpl ()

Detailed Description

Definition at line 104 of file nsComponentManager.h.


Constructor & Destructor Documentation

Definition at line 925 of file nsComponentManager.cpp.

{
    PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("nsComponentManager: Beginning destruction."));

    if (mShuttingDown != NS_SHUTDOWN_COMPLETE)
        Shutdown();

    if (mMon) {
        nsAutoMonitor::DestroyMonitor(mMon);
    }
    PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("nsComponentManager: Destroyed."));
}

Here is the call graph for this function:


Member Function Documentation

nsresult nsComponentManagerImpl::AddLoaderType ( const char *  typeStr,
int typeIndex 
)

Definition at line 2927 of file nsComponentManager.cpp.

{
    int typeIndex = GetLoaderType(typeStr);
    if (typeIndex >= 0) {
        *aTypeIndex = typeIndex;
        return NS_OK;
    }

    // Add the loader type
    if (mNLoaderData >= mMaxNLoaderData) {
        NS_ASSERTION(mNLoaderData == mMaxNLoaderData,
                     "Memory corruption. nsComponentManagerImpl::mLoaderData array overrun.");
        // Need to increase our loader array
        nsLoaderdata *new_mLoaderData = (nsLoaderdata *) PR_Realloc(mLoaderData, (mMaxNLoaderData + NS_LOADER_DATA_ALLOC_STEP) * sizeof(nsLoaderdata));
        if (!new_mLoaderData)
            return NS_ERROR_OUT_OF_MEMORY;
        mLoaderData = new_mLoaderData;
        mMaxNLoaderData += NS_LOADER_DATA_ALLOC_STEP;
    }

    typeIndex = mNLoaderData;
    mLoaderData[typeIndex].type = PL_strdup(typeStr);
    if (!mLoaderData[typeIndex].type) {
        // mmh! no memory. return failure.
        return NS_ERROR_OUT_OF_MEMORY;
    }
    mLoaderData[typeIndex].loader = nsnull;
    mNLoaderData++;

    *aTypeIndex = typeIndex;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

autoRegister

Register a component file or all component files in a directory.

Component files must have an associated loader and export the required symbols which this loader defines. For example, if the given file is a native library (which is built into XPCOM), it must export the symbol "NSGetModule". Other loaders may have different semantics.

This method may only be called from the main thread.

Parameters:
aSpec: Filename spec for component file's location. If aSpec is a directory, then every component file in the directory will be registered. If the aSpec is null, then the application component's directory as defined by NS_XPCOM_COMPONENT_DIR will be registered (see nsIDirectoryService.idl)
Returns:
NS_OK : Registration was successful. NS_ERROR: Method failure.

AutoRegister(RegistrationInstant, const char *directory)

Given a directory in the following format, this will ensure proper registration of all components. No default directory is looked at.

Directory and fullname are what NSPR will accept. For eg. WIN y:/home/dp/mozilla/dist/bin UNIX /home/dp/mozilla/dist/bin MAC /Hard drive/mozilla/dist/apprunner

This will take care not loading already registered dlls, finding and registering new dlls, re-registration of modified dlls

Definition at line 3144 of file nsComponentManager.cpp.

{
    return AutoRegisterImpl(when, inDirSpec);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIComponentManagerObsolete::autoRegister ( in long  when,
in nsIFile  directory 
) [inherited]

autoRegister

Enumerates directory looking for modules of all types and registers modules who have changed (modtime or size) since the last time autoRegister() was invoked.

Parameters:
when: ID values of when the call is being made.
directory: Directory the will be enumerated.
void nsIComponentManagerObsolete::autoRegisterComponent ( in long  when,
in nsIFile  aFileLocation 
) [inherited]

autoRegisterComponent

Loads module using appropriate loader and gives it an opportunity to register its CIDs if module's modtime or size changed since the last time this was called.

Parameters:
when: ID values of when the call is being made.
aFileLocation: File specification of module.
nsresult nsComponentManagerImpl::AutoRegisterImpl ( PRInt32  when,
nsIFile inDirSpec,
PRBool  fileIsCompDir = PR_TRUE 
)

Definition at line 3150 of file nsComponentManager.cpp.

{
    nsCOMPtr<nsIFile> dir;
    nsresult rv;

#ifdef DEBUG
    // testing release behaviour
    if (getenv("XPCOM_NO_AUTOREG"))
        return NS_OK;
#endif
    if (inDirSpec)
    {
        // Use supplied components' directory
        dir = inDirSpec;
    }
    else
    {
        mComponentsDir->Clone(getter_AddRefs(dir));
        if (!dir)
            return NS_ERROR_NOT_INITIALIZED;
    }

    nsCOMPtr<nsIInterfaceInfoManager> iim =
        dont_AddRef(XPTI_GetInterfaceInfoManager());

    if (!iim)
        return NS_ERROR_UNEXPECTED;

    // Notify observers of xpcom autoregistration start
    NS_CreateServicesFromCategory(NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID,
                                  nsnull,
                                  "start");

    /* Load static components first, then the native component loader,
     * which can find other loaders.
     */
    rv = mStaticComponentLoader->AutoRegisterComponents((PRInt32)when, inDirSpec);
    if (NS_FAILED(rv)) return rv;

    rv = mNativeComponentLoader->AutoRegisterComponents((PRInt32)when, dir);
    if (NS_FAILED(rv)) return rv;

    /* do InterfaceInfoManager after native loader so it can use components. */
    rv = iim->AutoRegisterInterfaces();
    if (NS_FAILED(rv)) return rv;

    if (!mCategoryManager) {
        NS_WARNING("mCategoryManager is null");
        return NS_ERROR_UNEXPECTED;
    }

    nsCOMPtr<nsISimpleEnumerator> loaderEnum;
    rv = mCategoryManager->EnumerateCategory("component-loader",
                                   getter_AddRefs(loaderEnum));
    if (NS_FAILED(rv)) return rv;

    PRBool hasMore;
    while (NS_SUCCEEDED(loaderEnum->HasMoreElements(&hasMore)) && hasMore) {
        nsCOMPtr<nsISupports> supports;
        if (NS_FAILED(loaderEnum->GetNext(getter_AddRefs(supports))))
            continue;

        nsCOMPtr<nsISupportsCString> supStr = do_QueryInterface(supports);
        if (!supStr)
            continue;

        nsCAutoString loaderType;
        if (NS_FAILED(supStr->GetData(loaderType)))
            continue;

        // We depend on the loader being created. Add the loader type and
        // create the loader object too.
        nsCOMPtr<nsIComponentLoader> loader;
        int typeIndex;
        rv = AddLoaderType(loaderType.get(), &typeIndex);
        if (NS_FAILED(rv))
            return rv;
        GetLoaderForType(typeIndex, getter_AddRefs(loader));
    }

    rv = AutoRegisterNonNativeComponents(dir.get());

    // Notify observers of xpcom autoregistration completion
    NS_CreateServicesFromCategory(NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID,
                                  nsnull,
                                  "end");

    if (mRegistryDirty)
        FlushPersistentStore(PR_TRUE);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3245 of file nsComponentManager.cpp.

{
    nsresult rv = NS_OK;
    nsCOMPtr<nsIFile> directory = spec;

    if (!directory) {
        mComponentsDir->Clone(getter_AddRefs(directory));
        if (!directory)
            return NS_ERROR_NOT_INITIALIZED;
    }

    for (int i = 1; i < mNLoaderData; i++) {
        if (!mLoaderData[i].loader) {
            rv = GetLoaderForType(i, &mLoaderData[i].loader);
            if (NS_FAILED(rv))
                continue;
        }
        rv = mLoaderData[i].loader->AutoRegisterComponents(0, directory);
        if (NS_FAILED(rv))
            break;
    }

    if (NS_SUCCEEDED(rv))
    {
        PRBool registered;
        do {
            registered = PR_FALSE;
            for (int i = 0; i < mNLoaderData; i++) {
                PRBool b = PR_FALSE;
                if (mLoaderData[i].loader) {
                    rv = mLoaderData[i].loader->RegisterDeferredComponents(0, &b);
                    if (NS_FAILED(rv))
                        continue;
                    registered |= b;
                }
            }
        } while (NS_SUCCEEDED(rv) && registered);
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

autoUnregister

Unregister a component file or all component files in a directory. This method may only be called from the main thread.

Parameters:
aSpec: Filename spec for component file's location. If aSpec is a directory, the every component file in the directory will be registered. If aSpec is null, then the application component's directory as defined by NS_XPCOM_COMPONENT_DIR will be registered. (see nsIDirectoryService.idl)
Returns:
NS_OK Unregistration was successful. NS_ERROR* Method failure.

Definition at line 3416 of file nsComponentManager.cpp.

{
    // unregistering a complete directory is not implmeneted yet...FIX
    if (aSpec == nsnull)
        return NS_ERROR_NOT_IMPLEMENTED;

    PRBool directory;
    aSpec->IsDirectory(&directory);

    if (directory)
        return NS_ERROR_NOT_IMPLEMENTED;

    return AutoUnregisterComponent(0, aSpec);
}
void nsIComponentManagerObsolete::autoUnregisterComponent ( in long  when,
in nsIFile  aFileLocation 
) [inherited]

autoUnregisterComponent

Loads module using approriate loader and gives it an opportunity to unregister its CIDs

Definition at line 3546 of file nsComponentManager.cpp.

{
    return CLSIDToContractID(aClass,
                             nsnull,
                             _retval);
}

Here is the call graph for this function:

string nsIComponentRegistrar::CIDToContractID ( in nsCIDRef  aClass) [inherited]

CIDToContractID.

Returns the Contract ID for a given CID, if one exists and is registered.

Returns:
: Contract ID.
string nsIComponentManagerObsolete::CLSIDToContractID ( in nsCIDRef  aClass,
out string  aClassName 
) [inherited]

classIDToContractid

Get the ContractID for a given ClassID. A ClassIDs may implement multiple ContractIDs. This function return the last registered ContractID.

Parameters:
aClass: ClassID for which ContractID is requested.
Returns:
aClassName : returns class name asssociated with aClass
: ContractID last registered for aClass

Here is the caller graph for this function:

NS_IMETHODIMP nsComponentManagerImpl::ContractIDToCID ( const char *  aContractID,
nsCID **  _retval 
)

Definition at line 3555 of file nsComponentManager.cpp.

{
    *_retval = (nsCID*) nsMemory::Alloc(sizeof(nsCID));
    if (!*_retval)
       return NS_ERROR_OUT_OF_MEMORY;

    nsresult rv = ContractIDToClassID(aContractID, *_retval);
    if (NS_FAILED(rv)) {
        nsMemory::Free(*_retval);
        *_retval = nsnull;
    }
    return rv;
}

Here is the call graph for this function:

nsCIDPtr nsIComponentRegistrar::contractIDToCID ( in string  aContractID) [inherited]

contractIDToCID

Returns the CID for a given Contract ID, if one exists and is registered.

Returns:
: Contract ID.
nsresult nsIComponentManagerObsolete::contractIDToClassID ( in string  aContractID,
out nsCID  aClass 
) [inherited]

contractIDToClassID

Get the ClassID for a given ContractID. Many ClassIDs may implement a ContractID. In such a situation, this returns the preferred ClassID, which happens to be the last registered ClassID.

Parameters:
aContractID: Contractid for which ClassID is requested
Returns:
aClass : ClassID return
void nsIComponentManager::createInstance ( in nsCIDRef  aClass,
in nsISupports  aDelegate,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]

createInstance

Create an instance of the CID aClass and return the interface aIID.

Parameters:
aClass: ClassID of object instance requested
aDelegate: Used for aggregation
aIID: IID of interface requested
voidPtr nsIComponentManagerObsolete::createInstance ( in nsCIDRef  aClass,
in nsISupports  aDelegate,
in nsIIDRef  aIID 
) [inherited]

createInstance

Create an instance of the CID aClass and return the interface aIID.

Parameters:
aClass: ClassID of object instance requested
aDelegate: Used for aggregation
aIID: IID of interface requested
void nsIComponentManager::createInstanceByContractID ( in string  aContractID,
in nsISupports  aDelegate,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]

createInstanceByContractID

Create an instance of the CID that implements aContractID and return the interface aIID.

Parameters:
aContractID: aContractID of object instance requested
aDelegate: Used for aggregation
aIID: IID of interface requested
voidPtr nsIComponentManagerObsolete::createInstanceByContractID ( in string  aContractID,
in nsISupports  aDelegate,
in nsIIDRef  IID 
) [inherited]

createInstanceByContractID

Create an instance of the CID that implements aContractID and return the interface aIID. This is a convenience function that effectively does ContractIDToClassID() followed by CreateInstance().

Parameters:
aContractID: aContractID of object instance requested
aDelegate: Used for aggregation
aIID: IID of interface requested

Definition at line 2990 of file nsComponentManager.cpp.

{
    UnregisterConditions aData;
    aData.cid     = aClass;
    aData.regName = registryName;
    aData.factory = nsnull;
    PL_DHashTableEnumerate(&mContractIDs, DeleteFoundCIDs, (void*)&aData);

}

Here is the call graph for this function:

Definition at line 3001 of file nsComponentManager.cpp.

Here is the call graph for this function:

Definition at line 3501 of file nsComponentManager.cpp.

{
    NS_ASSERTION(aEnumerator != nsnull, "null ptr");

    if (!aEnumerator)
        return NS_ERROR_NULL_POINTER;

    *aEnumerator = nsnull;

    nsresult rv;
    PLDHashTableEnumeratorImpl *aEnum;
    rv = PL_NewDHashTableEnumerator(&mFactories,
                                    ConvertFactoryEntryToCID,
                                    (void*)this,
                                    &aEnum);
    if (NS_FAILED(rv))
        return rv;

    *aEnumerator = NS_STATIC_CAST(nsISimpleEnumerator*, aEnum);
    return NS_OK;
}

Here is the call graph for this function:

enumerateCIDs

Enumerate the list of all registered CIDs.

Returns:
: enumerator for CIDs. Elements of the enumeration can be QI'ed for the nsISupportsID interface. From the nsISupportsID, you can obtain the actual CID.

enumerateCLSIDs

Enumerate the list of all registered ClassIDs.

Returns:
: enumerator for ClassIDs.

Definition at line 3375 of file nsComponentManager.cpp.

{
    NS_ASSERTION(aEnumerator != nsnull, "null ptr");
    if (!aEnumerator)
    {
        return NS_ERROR_NULL_POINTER;
    }

    *aEnumerator = nsnull;

    nsresult rv;
    PLDHashTableEnumeratorImpl *aEnum;
    rv = PL_NewDHashTableEnumerator(&mContractIDs,
                                    ConvertContractIDKeyToString,
                                    (void*)this,
                                    &aEnum);
    if (NS_FAILED(rv))
        return rv;

    *aEnumerator = NS_STATIC_CAST(nsIEnumerator*, aEnum);
    return NS_OK;
}

Here is the call graph for this function:

enumerateContractIDs

Enumerate the list of all registered ContractIDs.

Returns:
: enumerator for ContractIDs. Elements of the enumeration can be QI'ed for the nsISupportsCString interface. From the nsISupportsCString interface, you can obtain the actual Contract ID string.

enumerateContractIDs

Enumerate the list of all registered ContractIDs.

Returns:
: enumerator for ContractIDs.
nsIFactory nsIComponentManagerObsolete::findFactory ( in nsCIDRef  aClass) [inherited]

findFactory

Returns the factory object that can be used to create instances of CID aClass

Parameters:
aClassThe classid of the factory that is being requested
nsresult nsComponentManagerImpl::FindFactory ( const char *  contractID,
PRUint32  aContractIDLen,
nsIFactory **  aFactory 
)

FindFactory()

Given a classID, this finds the factory for this CID by first searching the local CID<->factory mapping. Next it searches for a Dll that implements this classID and calls LoadFactory() to create the factory.

Again, no attempt is made at storing the factory.

Definition at line 1645 of file nsComponentManager.cpp.

{
    PR_ASSERT(aFactory != nsnull);

    nsFactoryEntry *entry = GetFactoryEntry(aClass);

    if (!entry)
        return NS_ERROR_FACTORY_NOT_REGISTERED;

    return entry->GetFactory(aFactory, this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

freeLibraries

Enumerates all loaded modules and unloads unused modules.

Definition at line 2033 of file nsComponentManager.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIComponentManager::getClassObject ( in nsCIDRef  aClass,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]

getClassObject

Returns the factory object that can be used to create instances of CID aClass

Parameters:
aClassThe classid of the factory that is being requested
voidPtr nsIComponentManagerObsolete::getClassObject ( in nsCIDRef  aClass,
in nsIIDRef  aIID 
) [inherited]

getClassObject

Parameters:
aClass: CID of the class whose class object is requested
aIID: IID of an interface that the class object is known to to implement. nsISupports and nsIFactory are known to be implemented by the class object.
void nsIComponentManager::getClassObjectByContractID ( in string  aContractID,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]

getClassObjectByContractID

Returns the factory object that can be used to create instances of CID aClass

Parameters:
aClassThe classid of the factory that is being requested
nsresult nsComponentManagerImpl::GetClassObjectByContractID ( const char *  aContractID,
const nsIID aIID,
void **  _retval 
)

Definition at line 1713 of file nsComponentManager.cpp.

{
    nsresult rv;

    nsCOMPtr<nsIFactory> factory;

#ifdef PR_LOGGING
    if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_DEBUG))
    {
        PR_LogPrint("nsComponentManager: GetClassObject(%s)", contractID);
    }
#endif

    PR_ASSERT(aResult != nsnull);

    rv = FindFactory(contractID, strlen(contractID), getter_AddRefs(factory));
    if (NS_FAILED(rv)) return rv;

    rv = factory->QueryInterface(aIID, aResult);

    PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
           ("\t\tGetClassObject() %s", NS_SUCCEEDED(rv) ? "succeeded" : "FAILED"));

    return rv;
}

Here is the call graph for this function:

nsFactoryEntry * nsComponentManagerImpl::GetFactoryEntry ( const char *  aContractID,
PRUint32  aContractIDLen 
)

Definition at line 1592 of file nsComponentManager.cpp.

{
    nsFactoryEntry *fe = nsnull;
    {
        nsAutoMonitor mon(mMon);

        nsContractIDTableEntry* contractIDTableEntry =
            NS_STATIC_CAST(nsContractIDTableEntry*,
                           PL_DHashTableOperate(&mContractIDs, aContractID,
                                                PL_DHASH_LOOKUP));


        if (PL_DHASH_ENTRY_IS_BUSY(contractIDTableEntry)) {
            fe = contractIDTableEntry->mFactoryEntry;
        }
    }   //exit monitor

    return fe;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1615 of file nsComponentManager.cpp.

{
    nsFactoryEntry *entry = nsnull;
    {
        nsAutoMonitor mon(mMon);

        nsFactoryTableEntry* factoryTableEntry =
            NS_STATIC_CAST(nsFactoryTableEntry*,
                           PL_DHashTableOperate(&mFactories, &aClass,
                                                PL_DHASH_LOOKUP));

        if (PL_DHASH_ENTRY_IS_BUSY(factoryTableEntry)) {
            entry = factoryTableEntry->mFactoryEntry;
        }
    }   // exit monitor

    return entry;
}

Here is the call graph for this function:

void nsIInterfaceRequestor::getInterface ( in nsIIDRef  uuid,
[iid_is(uuid), retval] out nsQIResult  result 
) [inherited]

Retrieves the specified interface pointer.

Parameters:
uuidThe IID of the interface being requested.
result[out] The interface pointer to be filled in if the interface is accessible.
Returns:
NS_OK - interface was successfully returned. NS_NOINTERFACE - interface not accessible. NS_ERROR* - method failure.

Definition at line 205 of file nsComponentManager.h.

{ return mNLoaderData + 1; }

Here is the caller graph for this function:

Definition at line 2872 of file nsComponentManager.cpp.

{
    nsresult rv;

    // Make sure we have a valid type
    if (aType < 0 || aType >= mNLoaderData)
        return NS_ERROR_INVALID_ARG;

    *aLoader = mLoaderData[aType].loader;
    if (*aLoader) {
        NS_ADDREF(*aLoader);
        return NS_OK;
    }

    nsCOMPtr<nsIComponentLoader> loader;
    loader = do_GetServiceFromCategory("component-loader", mLoaderData[aType].type, &rv);
    if (NS_FAILED(rv))
        return rv;

    rv = loader->Init(this, nsnull);

    if (NS_SUCCEEDED(rv)) {
        mLoaderData[aType].loader = loader;
        NS_ADDREF(mLoaderData[aType].loader);
        *aLoader = loader;
        NS_ADDREF(*aLoader);
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2909 of file nsComponentManager.cpp.

{
    if (!typeStr || !*typeStr) {
        // Empty type strings are NATIVE
        return NS_COMPONENT_TYPE_NATIVE;
    }

    for (int i=NS_COMPONENT_TYPE_NATIVE; i<mNLoaderData; i++) {
        if (!strcmp(typeStr, mLoaderData[i].type))
            return i;
    }
    // Not found
    return NS_COMPONENT_TYPE_FACTORY_ONLY;
}

Here is the caller graph for this function:

string nsIComponentLoaderManager::getOptionalData ( in nsIFile  file,
in string  loaderString 
) [inherited]
void nsIServiceManager::getService ( in nsCIDRef  aClass,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]

getServiceByContractID

Returns the instance that implements aClass or aContractID and the interface aIID. This may result in the instance being created.

Parameters:
aClassor aContractID : aClass or aContractID of object instance requested
aIID: IID of interface requested
result: resulting service
NS_IMETHOD nsIServiceManagerObsolete::GetService ( const nsCID aClass,
const nsIID aIID,
nsISupports **  result,
nsIShutdownListener *  shutdownListener = nsnull 
) [pure virtual, inherited]

Here is the caller graph for this function:

NS_IMETHOD nsIServiceManagerObsolete::GetService ( const char *  aContractID,
const nsIID aIID,
nsISupports **  result,
nsIShutdownListener *  shutdownListener = nsnull 
) [pure virtual, inherited]
void nsIServiceManager::getServiceByContractID ( in string  aContractID,
in nsIIDRef  aIID,
[iid_is(aIID), retval] out nsQIResult  result 
) [inherited]
boolean nsIComponentLoaderManager::hasFileChanged ( in nsIFile  file,
in string  loaderString,
in PRInt64  modDate 
) [inherited]
nsresult nsComponentManagerImpl::HashContractID ( const char *  acontractID,
PRUint32  aContractIDLen,
nsFactoryEntry fe_ptr 
)

Definition at line 1529 of file nsComponentManager.cpp.

{
    if(!aContractID || !aContractIDLen)
        return NS_ERROR_NULL_POINTER;

    nsAutoMonitor mon(mMon);

    nsContractIDTableEntry* contractIDTableEntry =
        NS_STATIC_CAST(nsContractIDTableEntry*,
                       PL_DHashTableOperate(&mContractIDs, aContractID,
                                            PL_DHASH_ADD));
    if (!contractIDTableEntry)
        return NS_ERROR_OUT_OF_MEMORY;

    NS_ASSERTION(!contractIDTableEntry->mContractID || !strcmp(contractIDTableEntry->mContractID, aContractID), "contractid conflict");

    if (!contractIDTableEntry->mContractID) {
        char *contractID = ArenaStrndup(aContractID, aContractIDLen, &mArena);
        if (!contractID)
            return NS_ERROR_OUT_OF_MEMORY;

        contractIDTableEntry->mContractID = contractID;
        contractIDTableEntry->mContractIDLen = aContractIDLen;
    }

    contractIDTableEntry->mFactoryEntry = fe;

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsComponentManagerImpl::Init ( nsStaticModuleInfo const aStaticModules,
PRUint32  aStaticModuleCount 
)

Definition at line 725 of file nsComponentManager.cpp.

{
    PR_ASSERT(mShuttingDown != NS_SHUTDOWN_INPROGRESS);
    if (mShuttingDown == NS_SHUTDOWN_INPROGRESS)
        return NS_ERROR_FAILURE;

    mShuttingDown = NS_SHUTDOWN_NEVERHAPPENED;

    if (nsComponentManagerLog == nsnull)
    {
        nsComponentManagerLog = PR_NewLogModule("nsComponentManager");
    }

    // Initialize our arena
    PL_INIT_ARENA_POOL(&mArena, "ComponentManagerArena", NS_CM_BLOCK_SIZE);

    if (!mFactories.ops) {
        if (!PL_DHashTableInit(&mFactories, &factory_DHashTableOps,
                               0, sizeof(nsFactoryTableEntry),
                               1024)) {
            mFactories.ops = nsnull;
            return NS_ERROR_OUT_OF_MEMORY;
        }

        // Minimum alpha uses k=2 because nsFactoryTableEntry saves two
        // words compared to what a chained hash table requires.
        PL_DHashTableSetAlphaBounds(&mFactories,
                                    0.875,
                                    PL_DHASH_MIN_ALPHA(&mFactories, 2));
    }

    if (!mContractIDs.ops) {
        if (!PL_DHashTableInit(&mContractIDs, &contractID_DHashTableOps,
                               0, sizeof(nsContractIDTableEntry),
                               1024)) {
            mContractIDs.ops = nsnull;
            return NS_ERROR_OUT_OF_MEMORY;
        }

        // Minimum alpha uses k=1 because nsContractIDTableEntry saves one
        // word compared to what a chained hash table requires.
#if 0
        PL_DHashTableSetAlphaBounds(&mContractIDs,
                                    0.875,
                                    PL_DHASH_MIN_ALPHA(&mContractIDs, 1));
#endif
    }
    if (mMon == nsnull) {
        mMon = nsAutoMonitor::NewMonitor("nsComponentManagerImpl");
        if (mMon == nsnull)
            return NS_ERROR_OUT_OF_MEMORY;
    }

    if (mNativeComponentLoader == nsnull) {
        /* Create the NativeComponentLoader */
        mNativeComponentLoader = new nsNativeComponentLoader();
        if (!mNativeComponentLoader)
            return NS_ERROR_OUT_OF_MEMORY;
        NS_ADDREF(mNativeComponentLoader);

        nsresult rv = mNativeComponentLoader->Init(this, nsnull);
        if (NS_FAILED(rv))
            return rv;
    }

    // Add predefined loaders
    mLoaderData = (nsLoaderdata *) PR_Malloc(sizeof(nsLoaderdata) * NS_LOADER_DATA_ALLOC_STEP);
    if (!mLoaderData)
        return NS_ERROR_OUT_OF_MEMORY;
    mMaxNLoaderData = NS_LOADER_DATA_ALLOC_STEP;

    mNLoaderData = NS_COMPONENT_TYPE_NATIVE;
    mLoaderData[mNLoaderData].type = PL_strdup(nativeComponentType);
    mLoaderData[mNLoaderData].loader = mNativeComponentLoader;
    NS_ADDREF(mLoaderData[mNLoaderData].loader);
    mNLoaderData++;

    if (mStaticComponentLoader == nsnull) {
        nsresult rv = NewStaticComponentLoader(aStaticModules,
                                               aStaticModuleCount,
                                               &mStaticComponentLoader);
        if (NS_FAILED(rv))
            return rv;
    }

    mLoaderData[mNLoaderData].type = PL_strdup(staticComponentType);
    mLoaderData[mNLoaderData].loader = mStaticComponentLoader;
    NS_ADDREF(mLoaderData[mNLoaderData].loader);
    mNLoaderData++;

    if (mStaticComponentLoader) {
        /* Init the static loader */
        mStaticComponentLoader->Init(this, nsnull);
    }
    GetLocationFromDirectoryService(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(mComponentsDir));
    if (!mComponentsDir)
        return NS_ERROR_OUT_OF_MEMORY;

    nsCAutoString componentDescriptor;
    nsresult rv = mComponentsDir->GetNativePath(componentDescriptor);
    if (NS_FAILED(rv))
        return rv;

    mComponentsOffset = componentDescriptor.Length();

    GetLocationFromDirectoryService(NS_GRE_COMPONENT_DIR, getter_AddRefs(mGREComponentsDir));
    if (mGREComponentsDir) {
        nsresult rv = mGREComponentsDir->GetNativePath(componentDescriptor);
        if (NS_FAILED(rv)) {
            NS_WARNING("No GRE component manager");
            return rv;
        }
        mGREComponentsOffset = componentDescriptor.Length();
    }

    GetLocationFromDirectoryService(NS_XPCOM_COMPONENT_REGISTRY_FILE,
                                    getter_AddRefs(mRegistryFile));

    if(!mRegistryFile) {
        NS_WARNING("No Component Registry file was found in the directory service");
        return NS_ERROR_FAILURE;
    }

    PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG,
           ("nsComponentManager: Initialized."));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3481 of file nsComponentManager.cpp.

{
    return IsRegistered(aClass, _retval);
}
boolean nsIComponentRegistrar::isCIDRegistered ( in nsCIDRef  aClass) [inherited]

isCIDRegistered

Returns true if a factory is registered for the CID.

Parameters:
aClass: CID queried for registeration
Returns:
: true if a factory is registered for CID false otherwise.

Definition at line 3488 of file nsComponentManager.cpp.

{
    nsFactoryEntry *entry = GetFactoryEntry(aClass, strlen(aClass));

    if (entry)
        *_retval = PR_TRUE;
    else
        *_retval = PR_FALSE;
    return NS_OK;
}

Here is the call graph for this function:

isContractIDRegistered

Returns true if a factory is registered for the contract id.

Parameters:
aClass: contract id queried for registeration
Returns:
: true if a factory is registered for contract id false otherwise.
boolean nsIComponentManagerObsolete::isRegistered ( in nsCIDRef  aClass) [inherited]

isRegistered

Returns true if a factory or module is registered for CID aClass.

Parameters:
aClass: ClassID queried for registeration
Returns:
: true if a factory or module is registered for CID aClass. false otherwise.
boolean nsIServiceManager::isServiceInstantiated ( in nsCIDRef  aClass,
in nsIIDRef  aIID 
) [inherited]

isServiceInstantiated

isServiceInstantiated will return a true if the service has already been created, otherwise false

Parameters:
aClassor aContractID : aClass or aContractID of object instance requested
aIID: IID of interface requested
aIID: IID of interface requested
boolean nsIServiceManager::isServiceInstantiatedByContractID ( in string  aContractID,
in nsIIDRef  aIID 
) [inherited]

LoadFactory()

Given a FactoryEntry, this loads the dll if it has to, find the NSGetFactory symbol, calls the routine to create a new factory and returns it to the caller.

No attempt is made to store the factory in any form anywhere.

Definition at line 1571 of file nsComponentManager.cpp.

{

    if (!aFactory)
        return NS_ERROR_NULL_POINTER;
    *aFactory = nsnull;

    nsresult rv;
    rv = aEntry->GetFactory(aFactory, this);
    if (NS_FAILED(rv)) {
        PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
               ("nsComponentManager: FAILED to load factory from %s (%s)\n",
                (const char *)aEntry->mLocation, mLoaderData[aEntry->mTypeIndex].type));
        return rv;
    }

    return NS_OK;
}

Here is the call graph for this function:

nsresult nsComponentManagerImpl::NS_GetService ( const char *  aContractID,
const nsIID aIID,
PRBool  aDontCreate,
nsISupports **  result 
)

Definition at line 1031 of file nsComponentManager.cpp.

{

    // populate Category Manager. need to get this early so that we don't get
    // skipped by 'goto out'
    nsresult rv = GetService(kCategoryManagerCID,
                             NS_GET_IID(nsICategoryManager),
                             getter_AddRefs(mCategoryManager));
    if (NS_FAILED(rv))
        return rv;

    nsAutoMonitor mon(mMon);
    nsManifestLineReader reader;

    if (!mComponentsDir)
        return NS_ERROR_NOT_INITIALIZED;  // this should have been set by Init().

    PRFileDesc* fd = nsnull;

    // Set From Init
    if (!mRegistryFile) {
        return NS_ERROR_FILE_NOT_FOUND;
    }

    nsCOMPtr<nsIFile> file;
    mRegistryFile->Clone(getter_AddRefs(file));
    if (!file)
        return NS_ERROR_OUT_OF_MEMORY;

    nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(file));

    rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd);
    if (NS_FAILED(rv))
        return rv;

    PRInt64 fileSize;
    rv = localFile->GetFileSize(&fileSize);
    if (NS_FAILED(rv))
    {
        PR_Close(fd);
        return rv;
    }

    PRInt32 flen = nsInt64(fileSize);
    if (flen == 0)
    {
        PR_Close(fd);
        NS_WARNING("Persistent Registry Empty!");
        return NS_OK; // ERROR CONDITION
    }

    char* registry = new char[flen+1];
    if (!registry)
        goto out;

    if (flen > PR_Read(fd, registry, flen))
    {
        rv = NS_ERROR_FAILURE;
        goto out;
    }
    registry[flen] = '\0';

    reader.Init(registry, flen);

    if (ReadSectionHeader(reader, "HEADER"))
        goto out;

    if (!reader.NextLine())
        goto out;

    char* values[6];
    int lengths[6];

    // VersionLiteral,major,minor
    if (3 != reader.ParseLine(values, lengths, 3))
        goto out;

    // VersionLiteral
    if (!nsDependentCString(values[0], lengths[0]).EqualsLiteral("Version"))
        goto out;

    // major
    if (PERSISTENT_REGISTRY_VERSION_MAJOR != atoi(values[1]))
        goto out;

    // minor
    if (PERSISTENT_REGISTRY_VERSION_MINOR != atoi(values[2]))
        goto out;

    if (ReadSectionHeader(reader, "COMPONENTS"))
        goto out;

    while (1)
    {
        if (!reader.NextLine())
            break;

        //name,last_modification_date[,optionaldata]
        int parts = reader.ParseLine(values, lengths, 3);
        if (2 > parts)
            break;

        PRInt64 a = nsCRT::atoll(values[1]);
        AutoRegEntry *entry =
            new AutoRegEntry(nsDependentCString(values[0], lengths[0]), &a);

        if (!entry) {
            rv = NS_ERROR_OUT_OF_MEMORY;
            goto out;
        }

        if (parts == 3)
            entry->SetOptionalData(values[2]);

        nsCStringKey key((const char*)values[0]);
        mAutoRegEntries.Put(&key, entry);
    }

    if (ReadSectionHeader(reader, "CLASSIDS"))
        goto out;

    while (1)
    {
        if (!reader.NextLine())
            break;

        // cid,contract_id,type,class_name,inproc_server
        if (5 != reader.ParseLine(values, lengths, 5))
            break;

        nsCID aClass;
        if (!aClass.Parse(values[0]))
            continue;

        int loadertype = GetLoaderType(values[2]);
        if (loadertype < 0) {
            rv = AddLoaderType(values[2], &loadertype);
            if (NS_FAILED(rv))
                continue;
        }

        void *mem;
        PL_ARENA_ALLOCATE(mem, &mArena, sizeof(nsFactoryEntry));
        if (!mem) {
            rv = NS_ERROR_OUT_OF_MEMORY;
            goto out;
        }

        nsFactoryEntry *entry = new (mem) nsFactoryEntry(aClass, values[4], lengths[4], loadertype);
        if (!entry->mLocation) {
            rv = NS_ERROR_OUT_OF_MEMORY;
            goto out;
        }

        nsFactoryTableEntry* factoryTableEntry =
            NS_STATIC_CAST(nsFactoryTableEntry*,
                           PL_DHashTableOperate(&mFactories,
                                                &aClass,
                                                PL_DHASH_ADD));

        if (!factoryTableEntry) {
            rv = NS_ERROR_OUT_OF_MEMORY;
            goto out;
        }

        factoryTableEntry->mFactoryEntry = entry;

    }

    if (ReadSectionHeader(reader, "CONTRACTIDS"))
        goto out;

    while (1)
    {
        if (!reader.NextLine())
            break;

        //contractID,cid
        if (2 != reader.ParseLine(values, lengths, 2))
            break;

        nsCID aClass;
        if (!aClass.Parse(values[1]))
            continue;


        //need to find the location for this cid.
        nsFactoryEntry *cidEntry = GetFactoryEntry(aClass);
        if (!cidEntry || cidEntry->mTypeIndex < 0)
            continue; //what should we really do?

        nsContractIDTableEntry* contractIDTableEntry =
                NS_STATIC_CAST(nsContractIDTableEntry*,
                               PL_DHashTableOperate(&mContractIDs,
                                                    values[0],
                                                    PL_DHASH_ADD));
        if (!contractIDTableEntry) {
            continue;
        }

        if (!contractIDTableEntry->mContractID) {
            char *contractID = ArenaStrndup(values[0], lengths[0], &mArena);
            if (!contractID) {
                rv = NS_ERROR_OUT_OF_MEMORY;
                goto out; 
            }
            contractIDTableEntry->mContractID = contractID;
            contractIDTableEntry->mContractIDLen = lengths[0];
        }

        contractIDTableEntry->mFactoryEntry = cidEntry;
    }

#ifdef XPCOM_CHECK_PENDING_CIDS
    {
/*
 * If you get Asserts when you define SHOW_CI_ON_EXISTING_SERVICE and want to
 * track down their cause, then you should add the contracts listed by the
 * assertion to abusedContracts. The next time you run your xpcom app, xpcom
 * will assert the first time the object associated with the contract is
 * instantiated (which in many cases is the source of the problem).
 *
 * If you're doing this then you might want to NOP and soft breakpoint the
 * lines labeled: NOP_AND_BREAK.
 *
 * Otherwise XPCOM will refuse to create the object for the caller, which
 * while reasonable at some level, will almost certainly cause the app to
 * stop functioning normally.
 */
        static char abusedContracts[][128] = {
        /*// Example contracts:
            "@mozilla.org/rdf/container;1",
            "@mozilla.org/intl/charsetalias;1",
            "@mozilla.org/locale/win32-locale;1",
            "@mozilla.org/widget/lookandfeel/win;1",
        // */
            0
        };
        for (int i=0; abusedContracts[i] && *abusedContracts[i]; i++) {
            nsFactoryEntry *entry = nsnull;
            nsContractIDTableEntry* contractIDTableEntry =
                NS_STATIC_CAST(nsContractIDTableEntry*,
                               PL_DHashTableOperate(&mContractIDs, abusedContracts[i],
                                                    PL_DHASH_LOOKUP));

            if (PL_DHASH_ENTRY_IS_BUSY(contractIDTableEntry)) {
                entry = contractIDTableEntry->mFactoryEntry;
                AddPendingCID(entry->mCid);
            }
        }
    }
#endif

    if (ReadSectionHeader(reader, "CATEGORIES"))
        goto out;

    mCategoryManager->SuppressNotifications(PR_TRUE);

    while (1)
    {
        if (!reader.NextLine())
            break;

        //type,name,value
        if (3 != reader.ParseLine(values, lengths, 3))
            break;

        mCategoryManager->AddCategoryEntry(values[0],
                                           values[1],
                                           values[2],
                                           PR_TRUE,
                                           PR_TRUE,
                                           0);
    }

    mCategoryManager->SuppressNotifications(PR_FALSE);

    mRegistryDirty = PR_FALSE;
out:
    if (fd)
        PR_Close(fd);

    if (registry)
        delete [] registry;

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIComponentManagerObsolete::registerComponent ( in nsCIDRef  aClass,
in string  aClassName,
in string  aContractID,
in string  aLocation,
in boolean  aReplace,
in boolean  aPersist 
) [inherited]

registerComponent

Register a native dll module via its registry representation as returned by registryLocationForSpec() as the container of CID implemenation aClass and associate aContractID and aClassName to the CID aClass. Native dll component type is assumed.

Parameters:
aClass: CID implemenation contained in module
aClassName: Class name associated with CID aClass
aContractID: ContractID associated with CID aClass
aLocation: Location of module (dll). Format of this is the registry representation as returned by registryLocationForSpec()
aReplace: Boolean that indicates whether to replace a previous module registration for aClass.
aPersist: Remember this registration across sessions.
nsresult nsComponentManagerImpl::RegisterComponentCommon ( const nsCID aClass,
const char *  aClassName,
const char *  aContractID,
PRUint32  aContractIDLen,
const char *  aRegistryName,
PRUint32  aRegistryNameLen,
PRBool  aReplace,
PRBool  aPersist,
const char *  aType 
)

Definition at line 2783 of file nsComponentManager.cpp.

{
    nsIDKey key(aClass);
    nsAutoMonitor mon(mMon);

    nsFactoryEntry *entry = GetFactoryEntry(aClass);

    // Normalize proid and classname
    const char *contractID = (aContractID && *aContractID) ? aContractID : nsnull;
#ifdef PR_LOGGING
    if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_WARNING))
    {
        char *buf = aClass.ToString();
        PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
               ("nsComponentManager: RegisterComponentCommon(%s, %s, %s, %s)",
                buf,
                contractID ? contractID : "(null)",
                aRegistryName, aType));
        if (buf)
            PR_Free(buf);
    }
#endif
    if (entry && !aReplace) {
        PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
               ("\t\tFactory already registered."));
        return NS_ERROR_FACTORY_EXISTS;
    }

    int typeIndex = GetLoaderType(aType);

    nsCOMPtr<nsIComponentLoader> loader;
    nsresult rv = GetLoaderForType(typeIndex, getter_AddRefs(loader));
    if (NS_FAILED(rv)) {
        PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
               ("\t\tgetting loader for %s FAILED\n", aType));
        return rv;
    }

    if (entry) {
        entry->ReInit(aClass, aRegistryName, typeIndex);
    }
    else {

        // Arena allocate the nsFactoryEntry
        void *mem;
        PL_ARENA_ALLOCATE(mem, &mArena, sizeof(nsFactoryEntry));
        if (!mem)
            return NS_ERROR_OUT_OF_MEMORY;

        mRegistryDirty = PR_TRUE;
        entry = new (mem) nsFactoryEntry(aClass,
                                         aRegistryName, aRegistryNameLen,
                                         typeIndex);
        if (!entry->mLocation)
            return NS_ERROR_OUT_OF_MEMORY;

        nsFactoryTableEntry* factoryTableEntry =
            NS_STATIC_CAST(nsFactoryTableEntry*,
                           PL_DHashTableOperate(&mFactories, &aClass,
                                                PL_DHASH_ADD));

        if (!factoryTableEntry)
            return NS_ERROR_OUT_OF_MEMORY;

        factoryTableEntry->mFactoryEntry = entry;
    }

    // Update the ContractID->CLSID Map
    if (contractID) {
        rv = HashContractID(contractID, aContractIDLen, entry);
        if (NS_FAILED(rv)) {
            PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
                   ("\t\tHashContractID(%s) FAILED\n", contractID));
            return rv;
        }
    }
    return rv;
}

Here is the call graph for this function:

void nsIComponentManagerObsolete::registerComponentLib ( in nsCIDRef  aClass,
in string  aClassName,
in string  aContractID,
in string  aDllName,
in boolean  aReplace,
in boolean  aPersist 
) [inherited]

registerComponentLib

Register a native dll module via its dll name (not full path) as the container of CID implemenation aClass and associate aContractID and aClassName to the CID aClass. Native dll component type is assumed and the system services will be used to load this dll.

Parameters:
aClass: CID implemenation contained in module
aClassName: Class name associated with CID aClass
aContractID: ContractID associated with CID aClass
aDllNameLocation: Dll name of module.
aReplace: Boolean that indicates whether to replace a previous module registration for aClass.
aPersist: Remember this registration across sessions.
void nsIComponentManagerObsolete::registerComponentSpec ( in nsCIDRef  aClass,
in string  aClassName,
in string  aContractID,
in nsIFile  aLibrary,
in boolean  aReplace,
in boolean  aPersist 
) [inherited]

registerComponentSpec

Register a native dll module via its file specification as the container of CID implemenation aClass and associate aContractID and aClassName to the CID aClass. Native dll component type is assumed.

Parameters:
aClass: CID implemenation contained in module
aClassName: Class name associated with CID aClass
aContractID: ContractID associated with CID aClass
aLibrary: File specification Location of module (dll).
aReplace: Boolean that indicates whether to replace a previous module registration for aClass.
aPersist: Remember this registration across sessions.
void nsIComponentManagerObsolete::registerComponentWithType ( in nsCIDRef  aClass,
in string  aClassName,
in string  aContractID,
in nsIFile  aSpec,
in string  aLocation,
in boolean  aReplace,
in boolean  aPersist,
in string  aType 
) [inherited]

registerComponentWithType

Register a module's location via its registry representation as returned by registryLocationForSpec() as the container of CID implemenation aClass of type aType and associate aContractID and aClassName to the CID aClass.

Parameters:
aClass: CID implemenation contained in module
aClassName: Class name associated with CID aClass
aContractID: ContractID associated with CID aClass
aSpec: Filename spec for module's location.
aLocation: Location of module of type aType. Format of this string is the registry representation as returned by registryLocationForSpec()
aReplace: Boolean that indicates whether to replace a previous loader registration for aClass.
aPersist: Remember this registration across sessions.
aType: Component Type of CID aClass.
void nsIComponentRegistrar::registerFactory ( in nsCIDRef  aClass,
in string  aClassName,
in string  aContractID,
in nsIFactory  aFactory 
) [inherited]

registerFactory

Register a factory with a given ContractID, CID and Class Name.

Parameters:
aClass: CID of object
aClassName: Class Name of CID
aContractID: ContractID associated with CID aClass
aFactory: Factory that will be registered for CID aClass
Returns:
NS_OK Registration was successful. NS_ERROR* method failure.
NS_IMETHODIMP nsComponentManagerImpl::RegisterFactory ( const nsCID aClass,
const char *  aClassName,
const char *  aContractID,
nsIFactory aFactory 
)

RegisterFactory()

Register a factory to be responsible for creation of implementation of classID aClass. Plus creates as association of aClassName and aContractID to the classID. If replace is PR_TRUE, we replace any existing registrations with this one.

Once registration is complete, we add the class to the factories cache that we maintain. The factories cache is the ONLY place where these registrations are ever kept.

The other RegisterFunctions create a loader mapping and persistent location, but we just slam it into the cache here. And we don't call the loader's OnRegister function, either.

Definition at line 2633 of file nsComponentManager.cpp.

{
    nsAutoMonitor mon(mMon);
#ifdef PR_LOGGING
    if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_WARNING))
    {
        char *buf = aClass.ToString();
        PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
               ("nsComponentManager: RegisterFactory(%s, %s)", buf,
                (aContractID ? aContractID : "(null)")));
        if (buf)
            PR_Free(buf);
    }
#endif
    nsFactoryEntry *entry = nsnull;
    nsFactoryTableEntry* factoryTableEntry = NS_STATIC_CAST(nsFactoryTableEntry*,
                                                            PL_DHashTableOperate(&mFactories,
                                                                                 &aClass,
                                                                                 PL_DHASH_ADD));

    if (!factoryTableEntry)
        return NS_ERROR_OUT_OF_MEMORY;


    if (PL_DHASH_ENTRY_IS_BUSY(factoryTableEntry)) {
        entry = factoryTableEntry->mFactoryEntry;
    }

    if (entry && !aReplace)
    {
        // Already registered
        PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
               ("\t\tFactory already registered."));
        return NS_ERROR_FACTORY_EXISTS;
    }

    void *mem;
    PL_ARENA_ALLOCATE(mem, &mArena, sizeof(nsFactoryEntry));
    if (!mem)
        return NS_ERROR_OUT_OF_MEMORY;

    entry = new (mem) nsFactoryEntry(aClass, aFactory, entry);

    factoryTableEntry->mFactoryEntry = entry;

    // Update the ContractID->CLSID Map
    if (aContractID) {
        nsresult rv = HashContractID(aContractID, strlen(aContractID), entry);
        if (NS_FAILED(rv)) {
            PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
                   ("\t\tFactory register succeeded. "
                    "Hashing contractid (%s) FAILED.", aContractID));
            return rv;
        }
    }

    PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
           ("\t\tFactory register succeeded contractid=%s.",
            aContractID ? aContractID : "<none>"));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIComponentManagerObsolete::registerFactory ( in nsCIDRef  aClass,
in string  aClassName,
in string  aContractID,
in nsIFactory  aFactory,
in boolean  aReplace 
) [inherited]

registerFactory

Register a factory and ContractID associated with CID aClass

Parameters:
aClass: CID of object
aClassName: Class Name of CID
aContractID: ContractID associated with CID aClass
aFactory: Factory that will be registered for CID aClass
aReplace: Boolean that indicates whether to replace a previous registration for the CID aClass.
NS_IMETHODIMP nsComponentManagerImpl::RegisterFactoryLocation ( const nsCID aClass,
const char *  aClassName,
const char *  aContractID,
nsIFile aFile,
const char *  loaderStr,
const char *  aType 
)

Definition at line 3445 of file nsComponentManager.cpp.

{
    nsXPIDLCString registryName;

    if (!loaderStr)
    {
        nsresult rv = RegistryLocationForSpec(aFile, getter_Copies(registryName));
        if (NS_FAILED(rv))
            return rv;
    }

    nsresult rv;
    rv = RegisterComponentWithType(aClass,
                                   aClassName,
                                   aContractID,
                                   aFile,
                                   (loaderStr ? loaderStr : registryName.get()),
                                   PR_TRUE,
                                   PR_TRUE,
                                   (aType ? aType : nativeComponentType));
    return rv;
}

Here is the call graph for this function:

void nsIComponentRegistrar::registerFactoryLocation ( in nsCIDRef  aClass,
in string  aClassName,
in string  aContractID,
in nsIFile  aFile,
in string  aLoaderStr,
in string  aType 
) [inherited]

registerFactoryLocation

Register a factory with a given ContractID, CID and Class Name

Parameters:
aClass: CID of object
aClassName: Class Name of CID
aContractID: ContractID associated with CID aClass
aFile: Component File. This file must have an associated loader and export the required symbols which this loader specifies.
aLoaderStr: Opaque loader specific string. This value is passed into the nsIModule's registerSelf callback and must be fowarded unmodified when registering factories via their location.
aType: Component Type of CID aClass. This value is passed into the nsIModule's registerSelf callback and must be fowarded unmodified when registering factories via their location.
Returns:
NS_OK Registration was successful. NS_ERROR* Method failure.
NS_IMETHOD nsIServiceManagerObsolete::RegisterService ( const nsCID aClass,
nsISupports *  aService 
) [pure virtual, inherited]

RegisterService may be called explicitly to register a service with the service manager.

If a service is not registered explicitly, the component manager will be used to create an instance according to the class ID specified.

Here is the caller graph for this function:

NS_IMETHOD nsIServiceManagerObsolete::RegisterService ( const char *  aContractID,
nsISupports *  aService 
) [pure virtual, inherited]

registryLocationForSpec

Given a file specification, return the registry representation of the filename. Files that are found relative to the components directory will have a registry representation "rel:<relative-native-path>" while filenames that are not, will have "abs:<full-native-path>".

NS_IMETHOD nsIServiceManagerObsolete::ReleaseService ( const nsCID aClass,
nsISupports *  service,
nsIShutdownListener *  shutdownListener = nsnull 
) [pure virtual, inherited]
NS_IMETHOD nsIServiceManagerObsolete::ReleaseService ( const char *  aContractID,
nsISupports *  service,
nsIShutdownListener *  shutdownListener = nsnull 
) [pure virtual, inherited]
void nsIComponentLoaderManager::removeFileInfo ( in nsIFile  file,
in string  loaderString 
) [inherited]
void nsIComponentLoaderManager::saveFileInfo ( in nsIFile  file,
in string  loaderString,
in PRInt64  modDate 
) [inherited]
void nsIComponentLoaderManager::setOptionalData ( in nsIFile  file,
in string  loaderString,
in string  value 
) [inherited]

Definition at line 861 of file nsComponentManager.cpp.

{
    PR_ASSERT(mShuttingDown == NS_SHUTDOWN_NEVERHAPPENED);
    if (mShuttingDown != NS_SHUTDOWN_NEVERHAPPENED)
        return NS_ERROR_FAILURE;

    mShuttingDown = NS_SHUTDOWN_INPROGRESS;

    // Shutdown the component manager
    PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("nsComponentManager: Beginning Shutdown."));

    PRInt32 i;

    // Write out our component data file.
    if (mRegistryDirty) {
        nsresult rv = WritePersistentRegistry();
        if (NS_FAILED(rv)) {
            PR_LOG(nsComponentManagerLog, PR_LOG_ERROR, ("nsComponentManager: Could not write out perisistant registry."));
#ifdef DEBUG
            printf("Could not write out perisistant registry!\n");
#endif
        }
    }

    mAutoRegEntries.Reset(AutoRegEntryDestroy);

    // Release all cached factories
    if (mContractIDs.ops) {
        PL_DHashTableFinish(&mContractIDs);
        mContractIDs.ops = nsnull;
    }
    if (mFactories.ops) {
        PL_DHashTableFinish(&mFactories);
        mFactories.ops = nsnull;
    }
    // Unload libraries
    UnloadLibraries(nsnull, NS_Shutdown);

    // delete arena for strings and small objects
    PL_FinishArenaPool(&mArena);

    mComponentsDir = 0;

    mCategoryManager = 0;

    // Release all the component data - loaders and type strings
    for (i=0; i < mNLoaderData; i++) {
        NS_IF_RELEASE(mLoaderData[i].loader);
        PL_strfree((char *)mLoaderData[i].type);
    }
    PR_Free(mLoaderData);
    mLoaderData = nsnull;

    // we have an extra reference on this one, which is probably a good thing
    NS_IF_RELEASE(mNativeComponentLoader);
    NS_IF_RELEASE(mStaticComponentLoader);

    mShuttingDown = NS_SHUTDOWN_COMPLETE;

    PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("nsComponentManager: Shutdown complete."));

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

specForRegistyLocation

Create a file specification for the registry representation (rel:/abs:) got via registryLocationForSpec.

Definition at line 3100 of file nsComponentManager.cpp.

{
    nsresult rv = NS_OK;

    nsAutoMonitor mon(mMon);

    PR_LOG(nsComponentManagerLog, PR_LOG_WARNING,
           ("nsComponentManager: Unloading Libraries."));

    // UnloadAll the loaders
    // iterate over all known loaders and ask them to Unload.
    // Skip mNativeComponentLoader
    for (int i=NS_COMPONENT_TYPE_NATIVE + 1; i<mNLoaderData; i++) {
        if (mLoaderData[i].loader) {
            rv = mLoaderData[i].loader->UnloadAll(aWhen);
            if (NS_FAILED(rv))
                break;
        }
    }

    // UnloadAll the native loader
    rv = mNativeComponentLoader->UnloadAll(aWhen);
    return rv;
}

Here is the caller graph for this function:

void nsIComponentManagerObsolete::unregisterComponent ( in nsCIDRef  aClass,
in string  aLocation 
) [inherited]

unregisterComponent

Disassociate module aLocation represented as registry location as returned by registryLocationForSpec() as containing ClassID aClass.

Parameters:
aClass: ClassID being unregistered
aLocation: Location of module. Format of this is the registry representation as returned by registryLocationForSpec(). Components of any type will be unregistered.
void nsIComponentManagerObsolete::unregisterComponentSpec ( in nsCIDRef  aClass,
in nsIFile  aLibrarySpec 
) [inherited]

unregisterComponentSpec

Disassociate module references by file specification aLibrarySpec as containing ClassID aClass.

void nsIComponentRegistrar::unregisterFactory ( in nsCIDRef  aClass,
in nsIFactory  aFactory 
) [inherited]

unregisterFactory

Unregister a factory associated with CID aClass.

Parameters:
aClass: CID being unregistered
aFactory: Factory previously registered to create instances of CID aClass.
Returns:
NS_OK Unregistration was successful. NS_ERROR* Method failure.
void nsIComponentManagerObsolete::unregisterFactory ( in nsCIDRef  aClass,
in nsIFactory  aFactory 
) [inherited]

unregisterFactory

Unregister a factory associated with CID aClass.

Parameters:
aClass: ClassID being unregistered
aFactory: Factory previously registered to create instances of ClassID aClass.

Definition at line 3474 of file nsComponentManager.cpp.

{
    return UnregisterComponentSpec(aClass, aFile);
}
void nsIComponentRegistrar::unregisterFactoryLocation ( in nsCIDRef  aClass,
in nsIFile  aFile 
) [inherited]

unregisterFactoryLocation

Unregister a factory associated with CID aClass.

Parameters:
aClass: CID being unregistered
aFile: Component File previously registered
Returns:
NS_OK Unregistration was successful. NS_ERROR* Method failure.
NS_IMETHOD nsIServiceManagerObsolete::UnregisterService ( const nsCID aClass) [pure virtual, inherited]

Requests a service to be shut down, possibly unloading its DLL.

Returns:
NS_OK - if shutdown was successful and service was unloaded,
NS_ERROR_SERVICE_NOT_FOUND - if shutdown failed because the service was not currently loaded
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 nsIServiceManagerObsolete::UnregisterService ( const char *  aContractID) [pure virtual, inherited]

Definition at line 1420 of file nsComponentManager.cpp.

{
    if (!mRegistryFile)
        return NS_ERROR_FAILURE;  // this should have been set by Init().

    nsCOMPtr<nsIFile> file;
    mRegistryFile->Clone(getter_AddRefs(file));
    if (!file)
        return NS_ERROR_OUT_OF_MEMORY;

    nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(file));

    nsCAutoString originalLeafName;
    localFile->GetNativeLeafName(originalLeafName);

    nsCAutoString leafName;
    leafName.Assign(originalLeafName + NS_LITERAL_CSTRING(".tmp"));

    localFile->SetNativeLeafName(leafName);

    PRFileDesc* fd = nsnull;
    // Owner and group can setup components, everyone else should be able to see but not poison them.
    nsresult rv = localFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0664, &fd);
    if (NS_FAILED(rv))
        return rv;

    if (PR_fprintf(fd, "Generated File. Do not edit.\n") == (PRUint32) -1) {
        rv = NS_ERROR_UNEXPECTED;
        goto out;
    }

    if (PR_fprintf(fd, "\n[HEADER]\nVersion,%d,%d\n",
                   PERSISTENT_REGISTRY_VERSION_MAJOR,
                   PERSISTENT_REGISTRY_VERSION_MINOR) == (PRUint32) -1) {
        rv = NS_ERROR_UNEXPECTED;
        goto out;
    }

    if (PR_fprintf(fd, "\n[COMPONENTS]\n") == (PRUint32) -1) {
        rv = NS_ERROR_UNEXPECTED;
        goto out;
    }

    mAutoRegEntries.Enumerate(AutoRegEntryWriter, (void*)fd);

    PersistentWriterArgs args;
    args.mFD = fd;
    args.mLoaderData = mLoaderData;

    if (PR_fprintf(fd, "\n[CLASSIDS]\n") == (PRUint32) -1) {
        rv = NS_ERROR_UNEXPECTED;
        goto out;
    }


    PL_DHashTableEnumerate(&mFactories, ClassIDWriter, (void*)&args);

    if (PR_fprintf(fd, "\n[CONTRACTIDS]\n") == (PRUint32) -1) {
        rv = NS_ERROR_UNEXPECTED;
        goto out;
    }


    PL_DHashTableEnumerate(&mContractIDs, ContractIDWriter, (void*)&args);

    if (PR_fprintf(fd, "\n[CATEGORIES]\n") == (PRUint32) -1) {
        rv = NS_ERROR_UNEXPECTED;
        goto out;
    }


    if (!mCategoryManager) {
        NS_WARNING("Could not access category manager.  Will not be able to save categories!");
        rv = NS_ERROR_UNEXPECTED;
    } else {
        rv = mCategoryManager->WriteCategoryManagerToRegistry(fd);
    }

out:
    if (fd)
        PR_Close(fd);

    // don't create the file is there was a problem????
    NS_ENSURE_SUCCESS(rv, rv);

    if (!mRegistryFile)
        return NS_ERROR_NOT_INITIALIZED;

    PRBool exists;
    if(NS_FAILED(mRegistryFile->Exists(&exists)))
        return PR_FALSE;

    if(exists && NS_FAILED(mRegistryFile->Remove(PR_FALSE)))
        return PR_FALSE;

    nsCOMPtr<nsIFile> parent;
    mRegistryFile->GetParent(getter_AddRefs(parent));

    rv = localFile->MoveToNative(parent, originalLeafName);
    mRegistryDirty = PR_FALSE;

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 153 of file nsComponentManager.h.

Definition at line 242 of file nsComponentManager.h.

Definition at line 239 of file nsComponentManager.h.

Definition at line 240 of file nsComponentManager.h.

Definition at line 220 of file nsComponentManager.h.

Definition at line 221 of file nsComponentManager.h.

Definition at line 215 of file nsComponentManager.h.

Definition at line 214 of file nsComponentManager.h.

Definition at line 223 of file nsComponentManager.h.

Definition at line 224 of file nsComponentManager.h.

Definition at line 234 of file nsComponentManager.h.

Definition at line 236 of file nsComponentManager.h.

Definition at line 216 of file nsComponentManager.h.

Definition at line 218 of file nsComponentManager.h.

Definition at line 235 of file nsComponentManager.h.

Definition at line 238 of file nsComponentManager.h.

Definition at line 226 of file nsComponentManager.h.

Definition at line 232 of file nsComponentManager.h.

Definition at line 219 of file nsComponentManager.h.

Definition at line 281 of file nsIComponentManagerObsolete.idl.

Definition at line 283 of file nsIComponentManagerObsolete.idl.

ID values for 'when'.

Definition at line 280 of file nsIComponentManagerObsolete.idl.

Definition at line 282 of file nsIComponentManagerObsolete.idl.


The documentation for this class was generated from the following files: