Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
nsStaticComponentLoader Class Reference
Inheritance diagram for nsStaticComponentLoader:
Inheritance graph
[legend]
Collaboration diagram for nsStaticComponentLoader:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSICOMPONENTLOADER 
nsStaticComponentLoader ()
nsresult Init (nsStaticModuleInfo const *aStaticModules, PRUint32 aModuleCount)
nsIFactory getFactory (in nsIIDRef aCID, in string aLocation, in string aType)
 Get the factory for a given component.
void init (in nsIComponentManager aCompMgr, in nsISupports aRegistry)
 Initialize the loader.
void onRegister (in nsIIDRef aCID, in string aType, in string aClassName, in string aContractID, in string aLocation, in boolean aReplace, in boolean aPersist)
 Called when a component of the appropriate type is registered, to give the component loader an opportunity to do things like annotate the registry and such.
void autoRegisterComponents (in long aWhen, in nsIFile aDirectory)
 AutoRegister components in the given directory.
boolean autoRegisterComponent (in long aWhen, in nsIFile aComponent)
 AutoRegister the given component.
boolean autoUnregisterComponent (in long aWhen, in nsIFile aComponent)
 AutoUnregister the given component.
boolean registerDeferredComponents (in long aWhen)
 Register any deferred (NS_ERROR_FACTORY_REGISTER_AGAIN) components.
void unloadAll (in long aWhen)
 Unload all components that are willing.

Public Attributes

const long Startup = 0
 When is AutoRegistration occuring?
const long Component = 1
const long Timer = 2

Protected Member Functions

nsresult GetInfoFor (const char *aLocation, StaticModuleInfo **retval)

Protected Attributes

PRBool mAutoRegistered
nsCOMPtr< nsIComponentManagermComponentMgr
PLDHashTable mInfoHash
nsVoidArray mDeferredComponents
StaticModuleInfomFirst

Static Protected Attributes

static PLDHashTableOps sInfoHashOps

Private Member Functions

 ~nsStaticComponentLoader ()

Detailed Description

Definition at line 65 of file nsStaticComponentLoader.cpp.


Constructor & Destructor Documentation

Definition at line 71 of file nsStaticComponentLoader.cpp.

Definition at line 80 of file nsStaticComponentLoader.cpp.

Here is the call graph for this function:


Member Function Documentation

boolean nsIComponentLoader::autoRegisterComponent ( in long  aWhen,
in nsIFile  aComponent 
) [inherited]

AutoRegister the given component.

Returns true if the component was registered, false if it couldn't attempt to register the component (wrong type) and ``throws'' an NS_FAILED code if there was an error during registration.

void nsIComponentLoader::autoRegisterComponents ( in long  aWhen,
in nsIFile  aDirectory 
) [inherited]

AutoRegister components in the given directory.

boolean nsIComponentLoader::autoUnregisterComponent ( in long  aWhen,
in nsIFile  aComponent 
) [inherited]

AutoUnregister the given component.

Returns true if the component was unregistered, false if it coudln't attempt to unregister the component (not found, wrong type).

nsIFactory nsIComponentLoader::getFactory ( in nsIIDRef  aCID,
in string  aLocation,
in string  aType 
) [inherited]

Get the factory for a given component.

nsresult nsStaticComponentLoader::GetInfoFor ( const char *  aLocation,
StaticModuleInfo **  retval 
) [protected]

Definition at line 157 of file nsStaticComponentLoader.cpp.

{
    nsresult rv;
    StaticModuleInfo *info = 
        NS_STATIC_CAST(StaticModuleInfo *,
                       PL_DHashTableOperate(&mInfoHash, aLocation,
                                            PL_DHASH_LOOKUP));

    if (PL_DHASH_ENTRY_IS_FREE(info))
        return NS_ERROR_FACTORY_NOT_REGISTERED;

    if (!info->module) {
        rv = info->info.getModule(mComponentMgr, nsnull,
                             getter_AddRefs(info->module));
        LOG(("nSCL: GetInfoFor(\"%s\"): %lx\n", aLocation, rv));
        if (NS_FAILED(rv))
            return rv;
    }

    *retval = info;
    return NS_OK;
}

Here is the call graph for this function:

void nsIComponentLoader::init ( in nsIComponentManager  aCompMgr,
in nsISupports  aRegistry 
) [inherited]

Initialize the loader.

We use nsISupports here because nsIRegistry isn't IDLized yet.

Definition at line 122 of file nsStaticComponentLoader.cpp.

{
    if (!PL_DHashTableInit(&mInfoHash, &sInfoHashOps, nsnull,
                           sizeof(StaticModuleInfo), 1024)) {
        mInfoHash.ops = nsnull;
        return NS_ERROR_OUT_OF_MEMORY;
    }

    if (! aStaticModules)
        return NS_OK;

    StaticModuleInfo *prev = nsnull;

    for (PRUint32 i = 0; i < aModuleCount; ++i) {
        StaticModuleInfo *info =
            NS_STATIC_CAST(StaticModuleInfo *,
                           PL_DHashTableOperate(&mInfoHash, aStaticModules[i].name,
                                                PL_DHASH_ADD));
        if (!info)
            return NS_ERROR_OUT_OF_MEMORY;

        info->info = aStaticModules[i];
        if (prev)
            prev->next = info;
        else
            mFirst = info;

        prev = info;
    }

    return NS_OK;
}

Here is the call graph for this function:

void nsIComponentLoader::onRegister ( in nsIIDRef  aCID,
in string  aType,
in string  aClassName,
in string  aContractID,
in string  aLocation,
in boolean  aReplace,
in boolean  aPersist 
) [inherited]

Called when a component of the appropriate type is registered, to give the component loader an opportunity to do things like annotate the registry and such.

Register any deferred (NS_ERROR_FACTORY_REGISTER_AGAIN) components.

Return registered-any-components?

void nsIComponentLoader::unloadAll ( in long  aWhen) [inherited]

Unload all components that are willing.


Member Data Documentation

Definition at line 74 of file nsIComponentLoader.idl.

Definition at line 88 of file nsStaticComponentLoader.cpp.

Definition at line 89 of file nsStaticComponentLoader.cpp.

Definition at line 92 of file nsStaticComponentLoader.cpp.

Definition at line 93 of file nsStaticComponentLoader.cpp.

Definition at line 90 of file nsStaticComponentLoader.cpp.

When is AutoRegistration occuring?

Definition at line 73 of file nsIComponentLoader.idl.

Definition at line 75 of file nsIComponentLoader.idl.


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