nsIComponentLoader is dead - long live nsIModuleLoader! Take the

opportunity to remove support for nsIComponentManagerObsolete, and
formalize a nice shutdown API.

Not part of the build.


git-svn-id: svn://10.0.0.236/trunk@186246 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mhammond%skippinet.com.au
2005-12-19 05:05:45 +00:00
parent d1179099dd
commit afc19f2f56
14 changed files with 123 additions and 551 deletions

View File

@@ -53,7 +53,7 @@
#include "PyXPCOM_std.h"
#include <nsIModule.h>
#include <nsIComponentLoader.h>
#include <nsIFile.h>
class PyG_nsIModule : public PyG_Base, public nsIModule
{
@@ -156,142 +156,3 @@ PyG_nsIModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
Py_XDECREF(ret);
return nr;
}
///////////////////////////////////////////////////////////////////////////////////
class PyG_nsIComponentLoader : public PyG_Base, public nsIComponentLoader
{
public:
PyG_nsIComponentLoader(PyObject *instance) : PyG_Base(instance, NS_GET_IID(nsIComponentLoader)) {;}
PYGATEWAY_BASE_SUPPORT(nsIComponentLoader, PyG_Base);
NS_DECL_NSICOMPONENTLOADER
};
PyG_Base *MakePyG_nsIComponentLoader(PyObject *instance)
{
return new PyG_nsIComponentLoader(instance);
}
/* nsIFactory getFactory (in nsIIDRef aCID, in string aLocation, in string aType); */
NS_IMETHODIMP PyG_nsIComponentLoader::GetFactory(const nsIID & aCID, const char *aLocation, const char *aType, nsIFactory **_retval)
{
CEnterLeavePython _celp;
const char *methodName = "getFactory";
PyObject *iid = Py_nsIID::PyObjectFromIID(aCID);
PyObject *ret = NULL;
nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "Ozz",
iid,
aLocation,
aType);
Py_XDECREF(iid);
if (NS_SUCCEEDED(nr)) {
Py_nsISupports::InterfaceFromPyObject(ret, NS_GET_IID(nsIFactory), (nsISupports **)_retval, PR_FALSE);
if (PyErr_Occurred())
nr = HandleNativeGatewayError(methodName);
}
Py_XDECREF(ret);
return nr;
}
/* void init (in nsIComponentManager aCompMgr, in nsISupports aRegistry); */
NS_IMETHODIMP PyG_nsIComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aRegistry)
{
CEnterLeavePython _celp;
const char *methodName = "init";
PyObject *c = Py_nsISupports::PyObjectFromInterface(aCompMgr, NS_GET_IID(nsIComponentManager), PR_TRUE);
PyObject *r = Py_nsISupports::PyObjectFromInterface(aRegistry, NS_GET_IID(nsISupports), PR_TRUE);
nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "OO", c, r);
Py_XDECREF(c);
Py_XDECREF(r);
return nr;
}
/* void onRegister (in nsIIDRef aCID, in string aType, in string aClassName, in string aContractID, in string aLocation, in boolean aReplace, in boolean aPersist); */
NS_IMETHODIMP PyG_nsIComponentLoader::OnRegister(const nsIID & aCID, const char *aType, const char *aClassName, const char *aContractID, const char *aLocation, PRBool aReplace, PRBool aPersist)
{
CEnterLeavePython _celp;
const char *methodName = "onRegister";
PyObject *iid = Py_nsIID::PyObjectFromIID(aCID);
nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "Ossssii",
iid,
aType,
aClassName,
aContractID,
aLocation,
aReplace,
aPersist);
Py_XDECREF(iid);
return nr;
}
/* void autoRegisterComponents (in long aWhen, in nsIFile aDirectory); */
NS_IMETHODIMP PyG_nsIComponentLoader::AutoRegisterComponents(PRInt32 aWhen, nsIFile *aDirectory)
{
CEnterLeavePython _celp;
const char *methodName = "autoRegisterComponents";
PyObject *c = Py_nsISupports::PyObjectFromInterface(aDirectory, NS_GET_IID(nsIFile), PR_TRUE);
nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "iO", aWhen, c);
Py_XDECREF(c);
return nr;
}
/* boolean autoRegisterComponent (in long aWhen, in nsIFile aComponent); */
NS_IMETHODIMP PyG_nsIComponentLoader::AutoRegisterComponent(PRInt32 aWhen, nsIFile *aComponent, PRBool *_retval)
{
CEnterLeavePython _celp;
const char *methodName = "autoRegisterComponent";
PyObject *ret = NULL;
PyObject *c = Py_nsISupports::PyObjectFromInterface(aComponent, NS_GET_IID(nsIFile), PR_TRUE);
nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "iO", aWhen, c);
Py_XDECREF(c);
if (NS_SUCCEEDED(nr)) {
*_retval = PyInt_AsLong(ret);
if (PyErr_Occurred())
nr = HandleNativeGatewayError(methodName);
}
Py_XDECREF(ret);
return nr;
}
/* boolean autoUnregisterComponent (in long aWhen, in nsIFile aComponent); */
NS_IMETHODIMP PyG_nsIComponentLoader::AutoUnregisterComponent(PRInt32 aWhen, nsIFile *aComponent, PRBool *_retval)
{
CEnterLeavePython _celp;
const char *methodName = "autoUnregisterComponent";
PyObject *ret = NULL;
PyObject *c = Py_nsISupports::PyObjectFromInterface(aComponent, NS_GET_IID(nsIFile), PR_TRUE);
nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "iO", aWhen, c);
Py_XDECREF(c);
if (NS_SUCCEEDED(nr)) {
*_retval = PyInt_AsLong(ret);
if (PyErr_Occurred())
nr = HandleNativeGatewayError(methodName);
}
Py_XDECREF(ret);
return nr;
}
/* boolean registerDeferredComponents (in long aWhen); */
NS_IMETHODIMP PyG_nsIComponentLoader::RegisterDeferredComponents(PRInt32 aWhen, PRBool *_retval)
{
CEnterLeavePython _celp;
const char *methodName = "registerDeferredComponents";
PyObject *ret = NULL;
nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "i", aWhen);
if (NS_SUCCEEDED(nr)) {
*_retval = PyInt_AsLong(ret);
if (PyErr_Occurred())
nr = HandleNativeGatewayError(methodName);
}
Py_XDECREF(ret);
return nr;
}
/* void unloadAll (in long aWhen); */
NS_IMETHODIMP PyG_nsIComponentLoader::UnloadAll(PRInt32 aWhen)
{
CEnterLeavePython _celp;
const char *methodName = "unloadAll";
return InvokeNativeViaPolicy(methodName, NULL, "i", aWhen);
}