mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
give modules the ability to iterate over the registered names and targets
for a particular client.
This commit is contained in:
parent
040591c7ae
commit
f98ae2ca80
@ -154,9 +154,12 @@ public:
|
||||
DeleteFirst();
|
||||
}
|
||||
|
||||
T *First() { return mHead; }
|
||||
T *Last() { return mTail; }
|
||||
PRBool IsEmpty() { return mHead == NULL; }
|
||||
const T *First() const { return mHead; }
|
||||
T *First() { return mHead; }
|
||||
const T *Last() const { return mTail; }
|
||||
T *Last() { return mTail; }
|
||||
|
||||
PRBool IsEmpty() const { return mHead == NULL; }
|
||||
|
||||
protected:
|
||||
void AdvanceHead()
|
||||
|
@ -68,6 +68,10 @@ public:
|
||||
void DelTarget(const nsID &target);
|
||||
PRBool HasTarget(const nsID &target) const { return mTargets.Find(target) != NULL; }
|
||||
|
||||
// list iterators
|
||||
const ipcStringNode *Names() const { return mNames.First(); }
|
||||
const ipcIDNode *Targets() const { return mTargets.First(); }
|
||||
|
||||
//
|
||||
// returns TRUE if successfully enqueued. will return FALSE if client
|
||||
// does not have a registered message handler for this message's target.
|
||||
|
@ -413,6 +413,40 @@ ipcClient *IPC_GetClientByName(const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PRBool
|
||||
IPC_ClientHasName(ipcClient *client, const char *name)
|
||||
{
|
||||
return client->HasName(name);
|
||||
}
|
||||
|
||||
PRBool
|
||||
IPC_ClientHasTarget(ipcClient *client, const nsID &target)
|
||||
{
|
||||
return client->HasTarget(target);
|
||||
}
|
||||
|
||||
void
|
||||
IPC_EnumerateClientNames(ipcClient *client, ipcClientNameEnumFunc func, void *closure)
|
||||
{
|
||||
const ipcStringNode *node = client->Names();
|
||||
while (node) {
|
||||
if (func(closure, client, node->Value()) == PR_FALSE)
|
||||
break;
|
||||
node = node->mNext;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
IPC_EnumerateClientTargets(ipcClient *client, ipcClientTargetEnumFunc func, void *closure)
|
||||
{
|
||||
const ipcIDNode *node = client->Targets();
|
||||
while (node) {
|
||||
if (func(closure, client, node->Value()) == PR_FALSE)
|
||||
break;
|
||||
node = node->mNext;
|
||||
}
|
||||
}
|
||||
|
||||
ipcClient *IPC_GetClients(int *count)
|
||||
{
|
||||
*count = poll_fd_count - 1;
|
||||
|
@ -93,8 +93,22 @@ IPC_API const char *IPC_GetClientName(ipcClient *client);
|
||||
//
|
||||
// client lookup functions
|
||||
//
|
||||
IPC_API ipcClient *IPC_GetClientByID(int clientID);
|
||||
IPC_API ipcClient *IPC_GetClientByName(const char *clientName);
|
||||
IPC_API ipcClient *IPC_GetClientByID(int id);
|
||||
IPC_API ipcClient *IPC_GetClientByName(const char *name);
|
||||
|
||||
//
|
||||
// functions for inspecting the names and targets defined for a particular
|
||||
// client instance.
|
||||
//
|
||||
IPC_API PRBool IPC_ClientHasName(ipcClient *client, const char *name);
|
||||
IPC_API PRBool IPC_ClientHasTarget(ipcClient *client, const nsID &target);
|
||||
|
||||
// return PR_FALSE to end enumeration
|
||||
typedef PRBool (* ipcClientNameEnumFunc)(void *closure, ipcClient *client, const char *name);
|
||||
typedef PRBool (* ipcClientTargetEnumFunc)(void *closure, ipcClient *client, const nsID &target);
|
||||
|
||||
IPC_API void IPC_EnumerateClientNames(ipcClient *client, ipcClientNameEnumFunc func, void *closure);
|
||||
IPC_API void IPC_EnumerateClientTargets(ipcClient *client, ipcClientTargetEnumFunc func, void *closure);
|
||||
|
||||
//
|
||||
// return array of all clients, length equal to |count|.
|
||||
|
Loading…
Reference in New Issue
Block a user