Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

void tmTransactionManager::HandleTransaction ( tmTransaction aTrans  ) 

Called from the tmIPCModule. Decide where to send the message and dispatch it.

Definition at line 69 of file tmTransactionManager.cpp.

References AddQueue(), tmQueue::AttachClient(), tmQueue::DetachClient(), tmQueue::FlushQueue(), tmTransaction::GetAction(), tmTransaction::GetMessage(), tmTransaction::GetOwnerID(), GetQueue(), tmTransaction::GetQueueID(), name(), and tmQueue::PostTransaction().

Referenced by tmIPCModule::HandleMsg().


  PRUint32 action = aTrans->GetAction();
  PRUint32 ownerID = aTrans->GetOwnerID();
  tmQueue *queue = nsnull;

  // get the right queue -- attaches do it differently
  if (action == TM_ATTACH) {
    const char *name = (char*) aTrans->GetMessage(); // is qName for Attaches
    queue = GetQueue(name);  
    if (!queue) {
      PRInt32 index = AddQueue(name);
      if (index >= 0)
        queue = GetQueue(index); // GetQueue may return nsnull
  else  // all other trans should have a valid queue ID already
    queue = GetQueue(aTrans->GetQueueID());

  if (queue) {
    // All possible actions should have a case, default is not valid
    //   delete trans when done with them, let the queue own the trans
    //   that are posted to them.
    PRInt32 result = 0;
    switch (action) {
    case TM_ATTACH:
    case TM_POST:
      result = queue->PostTransaction(aTrans);
      if (result >= 0) // post failed, aTrans cached in a tmQueue
    case TM_FLUSH:
    case TM_DETACH:
      if (queue->DetachClient(ownerID) == TM_SUCCESS_DELETE_QUEUE) {
        // the last client has been removed, remove the queue
        RemoveQueue(aTrans->GetQueueID()); // this _could_ be out of bounds
      PR_NOT_REACHED("bad action in the transaction");
  delete aTrans;

Generated by  Doxygen 1.6.0   Back to index