add ipcModuleMethods::init

git-svn-id: svn://10.0.0.236/trunk@133269 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%netscape.com
2002-11-07 06:00:10 +00:00
parent 2acc29c026
commit 547b4d53a1
4 changed files with 20 additions and 1 deletions

View File

@@ -148,6 +148,10 @@ struct ipcCommandModule
// ipcModule interface impl
//
static void Init()
{
}
static void Shutdown()
{
}
@@ -187,6 +191,7 @@ ipcModuleMethods *IPC_GetCommandModuleMethods()
static ipcModuleMethods methods =
{
IPC_MODULE_METHODS_VERSION,
ipcCommandModule::Init,
ipcCommandModule::Shutdown,
ipcCommandModule::HandleMsg
};

View File

@@ -72,6 +72,11 @@ struct ipcModuleMethods
//
PRUint32 version;
//
// called after this module is registered.
//
void (* init) (void);
//
// called when this module will no longer be accessed.
//

View File

@@ -117,8 +117,11 @@ InitModuleFromLib(const char *modulesDir, const char *fileName)
if (func) {
ipcModuleEntry *entries = NULL;
int count = func(&gDaemonMethods, &entries);
for (int i=0; i<count; ++i)
for (int i=0; i<count; ++i) {
AddModule(entries[i].target, entries[i].methods, PR_LoadLibrary(buf));
if (entries[i].methods->init)
entries[i].methods->init();
}
}
PR_UnloadLibrary(lib);
}

View File

@@ -12,6 +12,11 @@ static const nsID TestModuleID =
struct TestModule
{
static void Init()
{
printf("*** TestModule::Init\n");
}
static void Shutdown()
{
printf("*** TestModule::Shutdown\n");
@@ -30,6 +35,7 @@ struct TestModule
static ipcModuleMethods gTestMethods =
{
IPC_MODULE_METHODS_VERSION,
TestModule::Init,
TestModule::Shutdown,
TestModule::HandleMsg
};