Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
OJITestLoaderFactory.cpp File Reference
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "OJITestLoader.h"
#include "OJITestLoaderFactory.h"

Go to the source code of this file.

Functions

static NS_DEFINE_IID (kISupportsIID, NS_ISUPPORTS_IID)
static NS_DEFINE_IID (kIServiceManagerIID, NS_ISERVICEMANAGER_IID)
static NS_DEFINE_IID (kIFactoryIID, NS_IFACTORY_IID)
static NS_DEFINE_CID (kComponentManagerCID, NS_COMPONENTMANAGER_CID)
static NS_DEFINE_CID (kOJITestLoaderCID, OJITESTLOADER_CID)
NS_EXPORT nsresult NSRegisterSelf (nsISupports *aServMgr, const char *path)
NS_EXPORT nsresult NSUnregisterSelf (nsISupports *aServMgr, const char *path)
NS_EXPORT nsresult NSGetFactory (nsISupports *serviceMgr, const nsCID &aClass, const char *aClassName, const char *aContractID, nsIFactory **aFactory)
NS_EXPORT PRBool NSCanUnload (nsISupports *serviceMgr)

Variables

static const char * loaderRegistryPath = "@mozilla.org/oji/test/api/loader;1"
static const char * loaderRegistryDesc = "OJI API Test Loader"
static const nsModuleComponentInfo components []

Function Documentation

static NS_DEFINE_CID ( kComponentManagerCID  ,
NS_COMPONENTMANAGER_CID   
) [static]
static NS_DEFINE_CID ( kOJITestLoaderCID  ,
OJITESTLOADER_CID   
) [static]
static NS_DEFINE_IID ( kISupportsIID  ,
NS_ISUPPORTS_IID   
) [static]
static NS_DEFINE_IID ( kIServiceManagerIID  ,
NS_ISERVICEMANAGER_IID   
) [static]
static NS_DEFINE_IID ( kIFactoryIID  ,
NS_IFACTORY_IID   
) [static]
NS_EXPORT PRBool NSCanUnload ( nsISupports *  serviceMgr)

Definition at line 145 of file OJITestLoaderFactory.cpp.

{
    return PR_FALSE;
}
NS_EXPORT nsresult NSGetFactory ( nsISupports *  serviceMgr,
const nsCID aClass,
const char *  aClassName,
const char *  aContractID,
nsIFactory **  aFactory 
)

Definition at line 123 of file OJITestLoaderFactory.cpp.

{
    if (!aClass.Equals(kOJITestLoaderCID)) {
        return NS_ERROR_FACTORY_NOT_LOADED;     // XXX right error?
    }

    OJITestLoaderFactory* factory = new OJITestLoaderFactory();
    if (factory == NULL) {
        return NS_ERROR_OUT_OF_MEMORY;
    }
    
    NS_ADDREF(factory);
    *aFactory = factory;
    
    return NS_OK;
}

Here is the call graph for this function:

NS_EXPORT nsresult NSRegisterSelf ( nsISupports *  aServMgr,
const char *  path 
)

Definition at line 68 of file OJITestLoaderFactory.cpp.

{
    printf("Registering OJITestLoader\n");

    nsresult rv;

    nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
    if (NS_FAILED(rv)) {
        return rv;
    }

    nsIComponentManager* compMgr;
    rv = servMgr->GetService(kComponentManagerCID, 
                             nsIComponentManager::GetIID(), 
                             (nsISupports**)&compMgr);
    if (NS_FAILED(rv)) {
        return rv;
    }

    rv = compMgr->RegisterComponent(kOJITestLoaderCID,
                                    loaderRegistryDesc,
                                    loaderRegistryPath,
                                    path, 
                                    PR_TRUE, PR_TRUE);

    (void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
    return rv;
}

Here is the call graph for this function:

NS_EXPORT nsresult NSUnregisterSelf ( nsISupports *  aServMgr,
const char *  path 
)

Definition at line 98 of file OJITestLoaderFactory.cpp.

{
    nsresult rv;
    
    nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
    if (NS_FAILED(rv)) {
        return rv;
    }

    nsIComponentManager* compMgr;
    rv = servMgr->GetService(kComponentManagerCID, 
                             nsIComponentManager::GetIID(), 
                             (nsISupports**)&compMgr);
    if (NS_FAILED(rv)) {
        return rv;
    }
    
    rv = compMgr->UnregisterComponent(kOJITestLoaderCID, path);

    (void)servMgr->ReleaseService(kComponentManagerCID, compMgr);
    return rv;
}

Here is the call graph for this function:


Variable Documentation

const char* loaderRegistryDesc = "OJI API Test Loader" [static]

Definition at line 54 of file OJITestLoaderFactory.cpp.

const char* loaderRegistryPath = "@mozilla.org/oji/test/api/loader;1" [static]

Definition at line 53 of file OJITestLoaderFactory.cpp.