Back to index

lightning-sunbird  0.9+nobinonly
Functions
ipcModuleReg.h File Reference
#include "ipcModule.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void IPC_InitModuleReg (const char *exePath)
void IPC_ShutdownModuleReg ()
ipcModuleMethodsIPC_GetModuleByTarget (const nsID &target)
void IPC_NotifyModulesClientUp (ipcClient *)
void IPC_NotifyModulesClientDown (ipcClient *)

Function Documentation

void IPC_InitModuleReg ( const char *  exePath)

Definition at line 153 of file ipcModuleReg.cpp.

{
    if (!(exePath && *exePath))
        return;

    //
    // register plug-in modules
    //
    char *p = PL_strrchr(exePath, IPC_PATH_SEP_CHAR);
    if (p == NULL) {
        LOG(("unexpected exe path\n"));
        return;
    }

    int baseLen = p - exePath;
    int finalLen = baseLen + 1 + sizeof(IPC_MODULES_DIR);

    // build full path to ipc modules
    char *modulesDir = (char*) malloc(finalLen);
    memcpy(modulesDir, exePath, baseLen);
    modulesDir[baseLen] = IPC_PATH_SEP_CHAR;
    memcpy(modulesDir + baseLen + 1, IPC_MODULES_DIR, sizeof(IPC_MODULES_DIR));

    LOG(("loading libraries in %s\n", modulesDir));
    // 
    // scan directory for IPC modules
    //
    PRDir *dir = PR_OpenDir(modulesDir);
    if (dir) {
        PRDirEntry *ent;
        while ((ent = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) {
            // 
            // locate extension, and check if dynamic library
            //

            const char *p = strrchr(ent->name, '.');
            if (p && PL_strcasecmp(p, MOZ_DLL_SUFFIX) == 0)
                InitModuleFromLib(modulesDir, ent->name);
        }
        PR_CloseDir(dir);
    }

    free(modulesDir);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 224 of file ipcModuleReg.cpp.

{
    for (int i = 0; i < ipcModuleCount; ++i) {
        ipcModuleRegEntry &entry = ipcModules[i];
        if (entry.methods->clientDown)
            entry.methods->clientDown(client);
    }
}

Here is the caller graph for this function:

Definition at line 214 of file ipcModuleReg.cpp.

{
    for (int i = 0; i < ipcModuleCount; ++i) {
        ipcModuleRegEntry &entry = ipcModules[i];
        if (entry.methods->clientUp)
            entry.methods->clientUp(client);
    }
}

Here is the caller graph for this function:

Definition at line 199 of file ipcModuleReg.cpp.

{
    //
    // shutdown modules in reverse order    
    //
    while (ipcModuleCount) {
        ipcModuleRegEntry &entry = ipcModules[--ipcModuleCount];
        if (entry.methods->shutdown)
            entry.methods->shutdown();
        if (entry.lib)
            PR_UnloadLibrary(entry.lib);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: