VirtualBox

Changeset 101915 in vbox


Ignore:
Timestamp:
Nov 7, 2023 9:13:04 AM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom: Remove some unused code in ipcdclient.cpp, bugref:10545

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/client/src/ipcdclient.cpp

    r86374 r101915  
    5959#include "pratom.h"
    6060
    61 #ifdef VBOX
    62 # include <iprt/critsect.h>
    63 # define VBOX_WITH_IPCCLIENT_RW_CS
    64 #endif
     61#include <iprt/critsect.h>
    6562
    6663/* ------------------------------------------------------------------------- */
     
    152149  ~ipcClientState()
    153150  {
    154 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    155     if (monitor)
    156       nsAutoMonitor::DestroyMonitor(monitor);
    157 #else
    158151    RTCritSectRwDelete(&critSect);
    159 #endif
    160   }
    161 
    162 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    163   //
    164   // the monitor protects the targetMap and the connected and shutdown flags.
    165   //
    166   // NOTE: we use a PRMonitor for this instead of a PRLock because we need
    167   //       the lock to be re-entrant.  since we don't ever need to wait on
    168   //       this monitor, it might be worth it to implement a re-entrant
    169   //       wrapper for PRLock.
    170   //
    171   PRMonitor    *monitor;
    172 #else  /* VBOX_WITH_IPCCLIENT_RW_CS */
     152  }
     153
    173154  RTCRITSECTRW  critSect;
    174 #endif /* VBOX_WITH_IPCCLIENT_RW_CS */
    175155  ipcTargetMap  targetMap;
    176156  PRBool        connected;
     
    185165
    186166  ipcClientState()
    187 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    188     : monitor(nsAutoMonitor::NewMonitor("ipcClientState"))
    189     , connected(PR_FALSE)
    190 #else
    191167    : connected(PR_FALSE)
    192 #endif
    193168    , shutdown(PR_FALSE)
    194169    , selfID(0)
    195170  {
    196 #ifdef VBOX_WITH_IPCCLIENT_RW_CS
    197171    /* Not employing the lock validator here to keep performance up in debug builds. */
    198172    RTCritSectRwInitEx(&critSect, RTCRITSECT_FLAGS_NO_LOCK_VAL, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, NULL);
    199 #endif
    200173  }
    201174};
     
    208181    return NULL;
    209182
    210 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    211   if (!cs->monitor || !cs->targetMap.Init())
    212 #else
    213183  if (!RTCritSectRwIsInitialized(&cs->critSect) || !cs->targetMap.Init())
    214 #endif
    215184  {
    216185    delete cs;
     
    228197GetTarget(const nsID &aTarget, ipcTargetData **td)
    229198{
    230 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    231   nsAutoMonitor mon(gClientState->monitor);
    232   return gClientState->targetMap.Get(nsIDHashKey(&aTarget).GetKey(), td);
    233 #else
    234199  RTCritSectRwEnterShared(&gClientState->critSect);
    235200  PRBool fRc = gClientState->targetMap.Get(nsIDHashKey(&aTarget).GetKey(), td);
    236201  RTCritSectRwLeaveShared(&gClientState->critSect);
    237202  return fRc;
    238 #endif
    239203}
    240204
     
    242206PutTarget(const nsID &aTarget, ipcTargetData *td)
    243207{
    244 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    245   nsAutoMonitor mon(gClientState->monitor);
    246   return gClientState->targetMap.Put(nsIDHashKey(&aTarget).GetKey(), td);
    247 #else
    248208  RTCritSectRwEnterExcl(&gClientState->critSect);
    249209  PRBool fRc = gClientState->targetMap.Put(nsIDHashKey(&aTarget).GetKey(), td);
    250210  RTCritSectRwLeaveExcl(&gClientState->critSect);
    251211  return fRc;
    252 #endif
    253212}
    254213
     
    256215DelTarget(const nsID &aTarget)
    257216{
    258 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    259   nsAutoMonitor mon(gClientState->monitor);
    260   gClientState->targetMap.Remove(nsIDHashKey(&aTarget).GetKey());
    261 #else
    262217  RTCritSectRwEnterExcl(&gClientState->critSect);
    263218  gClientState->targetMap.Remove(nsIDHashKey(&aTarget).GetKey());
    264219  RTCritSectRwLeaveExcl(&gClientState->critSect);
    265 #endif
    266220}
    267221
     
    857811      // all targets but IPCM will not be able to use WaitTarget any more.
    858812
    859 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    860       nsAutoMonitor mon(gClientState->monitor);
    861 #else
    862813      RTCritSectRwEnterExcl(&gClientState->critSect);
    863 #endif
    864 
    865814      gClientState->shutdown = PR_TRUE;
    866815      gClientState->targetMap.EnumerateRead(EnumerateTargetMapAndNotify, nsnull);
    867 
    868 #ifdef VBOX_WITH_IPCCLIENT_RW_CS
    869816      RTCritSectRwLeaveExcl(&gClientState->critSect);
    870 #endif
    871817    }
    872818
     
    13571303  // unblock any calls to WaitTarget.
    13581304
    1359 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    1360   nsAutoMonitor mon(gClientState->monitor);
    1361 #else
    13621305  RTCritSectRwEnterExcl(&gClientState->critSect);
    1363 #endif
    1364 
    13651306  gClientState->connected = PR_FALSE;
    13661307  gClientState->targetMap.EnumerateRead(EnumerateTargetMapAndNotify, nsnull);
    1367 
    1368 #ifdef VBOX_WITH_IPCCLIENT_RW_CS
    13691308  RTCritSectRwLeaveExcl(&gClientState->critSect);
    1370 #endif
    13711309}
    13721310
     
    14691407        // targets) giving them an opportuninty to finish wait cycle because of
    14701408        // the peer client death, when appropriate.
    1471 #ifndef VBOX_WITH_IPCCLIENT_RW_CS
    1472         nsAutoMonitor mon(gClientState->monitor);
    1473 #else
    14741409        RTCritSectRwEnterShared(&gClientState->critSect);
    1475 #endif
    1476 
    14771410        gClientState->targetMap.EnumerateRead(EnumerateTargetMapAndPlaceMsg, msg);
    1478 
    1479 #ifdef VBOX_WITH_IPCCLIENT_RW_CS
    14801411        RTCritSectRwLeaveShared(&gClientState->critSect);
    1481 #endif
     1412
    14821413        delete msg;
    1483 
    14841414        return;
    14851415      }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette