Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsFactoryEntry Class Reference

Class: nsFactoryEntry() More...

#include <nsComponentManager.h>

Collaboration diagram for nsFactoryEntry:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsFactoryEntry (const nsCID &aClass, const char *location, PRUint32 locationlen, int aType, class nsFactoryEntry *parent=nsnull)
 nsFactoryEntry (const nsCID &aClass, nsIFactory *aFactory, class nsFactoryEntry *parent=nsnull)
 ~nsFactoryEntry ()
nsresult ReInit (const nsCID &aClass, const char *location, int aType)
nsresult GetFactory (nsIFactory **aFactory, nsComponentManagerImpl *mgr)

Public Attributes

nsCID mCid
nsCOMPtr< nsIFactorymFactory
int mTypeIndex
nsCOMPtr< nsISupports > mServiceObject
char * mLocation
class nsFactoryEntrymParent

Detailed Description

Class: nsFactoryEntry()

There are two types of FactoryEntries.

  1. {CID, dll} mapping. Factory is a consequence of the dll. These can be either session specific or persistent based on whether we write this to the registry or not.
  1. {CID, factory} mapping These are strictly session specific and in memory only.

Definition at line 275 of file nsComponentManager.h.


Constructor & Destructor Documentation

nsFactoryEntry::nsFactoryEntry ( const nsCID aClass,
const char *  location,
PRUint32  locationlen,
int  aType,
class nsFactoryEntry parent = nsnull 
)

Definition at line 365 of file nsComponentManager.cpp.

: mCid(aClass),
  mTypeIndex(aType),
  mParent(parent)
{
    // Arena allocate the location string
    mLocation = ArenaStrndup(aLocation, locationlen, &nsComponentManagerImpl::gComponentManager->mArena);
}

Here is the call graph for this function:

nsFactoryEntry::nsFactoryEntry ( const nsCID aClass,
nsIFactory aFactory,
class nsFactoryEntry parent = nsnull 
)

Definition at line 378 of file nsComponentManager.cpp.

Definition at line 391 of file nsComponentManager.cpp.

{
    // Release the reference to the factory
    mFactory = nsnull;

    // Release any service reference
    mServiceObject = nsnull;

    // nsFactoryEntry is arena allocated. So we dont delete it.
    // We call the destructor by hand.
    if (mParent)
        mParent->~nsFactoryEntry();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

Definition at line 284 of file nsComponentManager.h.

                                                      {
        if (mFactory) {
            *aFactory = mFactory.get();
            NS_ADDREF(*aFactory);
            return NS_OK;
        }

        if (mTypeIndex < 0)
            return NS_ERROR_FAILURE;

        nsresult rv;
        nsCOMPtr<nsIComponentLoader> loader;
        rv = mgr->GetLoaderForType(mTypeIndex, getter_AddRefs(loader));
        if(NS_FAILED(rv))
            return rv;

        rv = loader->GetFactory(mCid, mLocation, mgr->mLoaderData[mTypeIndex].type, aFactory);
        if (NS_FAILED(rv))
            return rv;

        NS_ASSERTION(*aFactory, "Loader says it succeeded; got null factory!");
        mFactory = do_QueryInterface(*aFactory);
        if (!mFactory)
            return NS_ERROR_NO_INTERFACE;

        return NS_OK;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsFactoryEntry::ReInit ( const nsCID aClass,
const char *  location,
int  aType 
)

Definition at line 406 of file nsComponentManager.cpp.

{
    NS_ENSURE_TRUE(mTypeIndex != NS_COMPONENT_TYPE_FACTORY_ONLY, NS_ERROR_INVALID_ARG);
    // cid has to match
    // SERVICE_ONLY entries can be promoted to an entry of another type
    NS_ENSURE_TRUE((mTypeIndex == NS_COMPONENT_TYPE_SERVICE_ONLY || mCid.Equals(aClass)),
                   NS_ERROR_INVALID_ARG);

    // Arena allocate the location string
    mLocation = ArenaStrdup(aLocation, &nsComponentManagerImpl::gComponentManager->mArena);
    if (!mLocation)
        return NS_ERROR_OUT_OF_MEMORY;

    mTypeIndex = aType;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 313 of file nsComponentManager.h.

Definition at line 314 of file nsComponentManager.h.

Definition at line 318 of file nsComponentManager.h.

Definition at line 319 of file nsComponentManager.h.

Definition at line 317 of file nsComponentManager.h.

Definition at line 316 of file nsComponentManager.h.


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