VirtualBox

Changeset 101967 in vbox for trunk/src/libs/xpcom18a4


Ignore:
Timestamp:
Nov 8, 2023 12:44:46 PM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom/xpcom: Convert PR_Atomic* to ASMAtomic*, bugref:10545

Location:
trunk/src/libs/xpcom18a4/xpcom
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/glue/nsISupportsImpl.h

    r65406 r101967  
    4747
    4848#include "prthread.h" /* needed for thread-safety checks */
    49 #include "pratom.h"   /* needed for PR_AtomicIncrement and PR_AtomicDecrement */
    5049
    5150#include "nsDebug.h"
     
    740739  NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt");                   \
    741740  nsrefcnt count;                                                             \
    742   count = PR_AtomicIncrement((PRInt32*)&mRefCnt);                             \
     741  count = ASMAtomicIncU32((volatile uint32_t *)&mRefCnt);                     \
    743742  NS_LOG_ADDREF(this, count, #_class, sizeof(*this));                         \
    744743  return count;                                                               \
     
    793792  nsrefcnt count;                                                             \
    794793  NS_PRECONDITION(0 != mRefCnt, "dup release");                               \
    795   count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);                            \
     794  count = ASMAtomicDecI32((volatile uint32_t *)&mRefCnt);                     \
    796795  NS_LOG_RELEASE(this, count, #_class);                                       \
    797796  if (0 == count) {                                                           \
  • trunk/src/libs/xpcom18a4/xpcom/proxy/public/nsProxyEvent.h

    r1 r101967  
    167167    PRUint32         mParameterCount;            /* number of params */
    168168    PLEvent         *mEvent;                     /* the current plevent */       
    169     PRInt32          mCompleted;                 /* is true when the method has been called. */
     169    volatile bool    mCompleted;                 /* is true when the method has been called. */
    170170       
    171171    nsCOMPtr<nsIEventQueue>  mCallersEventQ;     /* this is the eventQ that we must post a message back to
  • trunk/src/libs/xpcom18a4/xpcom/proxy/public/nsProxyRelease.h

    r50361 r101967  
    4040
    4141#include "nsIEventQueueService.h"
    42 #include "pratom.h"
    4342#include "prmem.h"
    4443
     
    6463{                                                                               \
    6564  NS_PRECONDITION(0 != mRefCnt, "dup release");                                 \
    66   nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);                     \
     65  nsrefcnt count = ASMAtomicDecU32((volatile uint32_t *)&mRefCnt);              \
    6766  NS_LOG_RELEASE(this, count, #_class);                                         \
    6867                                                                                \
  • trunk/src/libs/xpcom18a4/xpcom/proxy/src/nsProxyEvent.cpp

    r101847 r101967  
    5454#include "nsCRT.h"
    5555
    56 #include "pratom.h"
    5756#include "prmem.h"
    5857#include "xptcall.h"
     
    9493    NS_ASSERTION(event, "No PLEvent!");
    9594
    96     mCompleted        = 0;
     95    mCompleted        = false;
    9796    mMethodIndex      = methodIndex;
    9897    mParameterList    = parameterList;
     
    232231nsProxyObjectCallInfo::GetCompleted()
    233232{
    234     return (PRBool)mCompleted;
     233    return ASMAtomicReadBool(&mCompleted) ? PR_TRUE : PR_FALSE;
    235234}
    236235
     
    238237nsProxyObjectCallInfo::SetCompleted()
    239238{
    240     PR_AtomicSet(&mCompleted, 1);
     239    ASMAtomicWriteBool(&mCompleted, true);
    241240}
    242241
     
    311310nsProxyObject::AddRef()
    312311{
    313   PR_AtomicIncrement((PRInt32 *)&mRefCnt);
     312  ASMAtomicIncU32((volatile uint32_t *)&mRefCnt);
    314313  NS_LOG_ADDREF(this, mRefCnt, "nsProxyObject", sizeof(*this));
    315314}
     
    320319  NS_PRECONDITION(0 != mRefCnt, "dup release");
    321320
    322   nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
     321  nsrefcnt count = ASMAtomicDecU32((volatile uint32_t *)&mRefCnt);
    323322  NS_LOG_RELEASE(this, count, "nsProxyObject");
    324323
  • trunk/src/libs/xpcom18a4/xpcom/proxy/src/nsProxyEventObject.cpp

    r1 r101967  
    488488    // Decrement atomically - in case the Proxy Object Manager has already
    489489    // been deleted and the monitor is unavailable...
    490     count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
     490    count = ASMAtomicDecU32((volatile uint32_t *)&mRefCnt);
    491491    NS_LOG_RELEASE(this, count, "nsProxyEventObject");
    492492    if (0 == count) {
  • trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp

    r101914 r101967  
    775775xptiInterfaceInfo::AddRef(void)
    776776{
    777     nsrefcnt cnt = (nsrefcnt) PR_AtomicIncrement((PRInt32*)&mRefCnt);
     777    nsrefcnt cnt = (nsrefcnt) ASMAtomicIncU32((volatile uint32_t *)&mRefCnt);
    778778    NS_LOG_ADDREF(this, cnt, "xptiInterfaceInfo", sizeof(*this));
    779779    return cnt;
     
    784784{
    785785    xptiInterfaceEntry* entry = mEntry;
    786     nsrefcnt cnt = (nsrefcnt) PR_AtomicDecrement((PRInt32*)&mRefCnt);
     786    nsrefcnt cnt = (nsrefcnt) ASMAtomicDecU32((volatile uint32_t *)&mRefCnt);
    787787    NS_LOG_RELEASE(this, cnt, "xptiInterfaceInfo");
    788788    if(!cnt)
  • trunk/src/libs/xpcom18a4/xpcom/string/src/nsSubstring.cpp

    r31259 r101967  
    5050#include "nsDependentString.h"
    5151#include "nsMemory.h"
    52 #include "pratom.h"
    53 #ifdef VBOX_USE_IPRT_IN_XPCOM
     52#ifdef VBOX_USE_IPRT_IN_XPCOM
     53# include <iprt/asm.h>
    5454# include <iprt/mem.h>
    5555#endif
     
    9898        }
    9999
    100       PRInt32 mAllocCount;
    101       PRInt32 mReallocCount;
    102       PRInt32 mFreeCount;
    103       PRInt32 mShareCount;
    104       PRInt32 mAdoptCount;
    105       PRInt32 mAdoptFreeCount;
     100      volatile uint32_t mAllocCount;
     101      volatile uint32_t mReallocCount;
     102      volatile uint32_t mFreeCount;
     103      volatile uint32_t mShareCount;
     104      volatile uint32_t mAdoptCount;
     105      volatile uint32_t mAdoptFreeCount;
    106106  };
    107107static nsStringStats gStringStats;
    108 #define STRING_STAT_INCREMENT(_s) PR_AtomicIncrement(&gStringStats.m ## _s ## Count)
     108#define STRING_STAT_INCREMENT(_s) ASMAtomicIncU32(&gStringStats.m ## _s ## Count)
    109109#else
    110110#define STRING_STAT_INCREMENT(_s)
     
    126126    private:
    127127
    128       PRInt32 mRefCount;
     128      volatile uint32_t mRefCount;
    129129      PRUint32 mStorageSize;
    130130
     
    133133      void AddRef()
    134134        {
    135           PR_AtomicIncrement(&mRefCount);
     135          ASMAtomicIncU32(&mRefCount);
    136136          STRING_STAT_INCREMENT(Share);
    137137        }
     
    139139      void Release()
    140140        {
    141           if (PR_AtomicDecrement(&mRefCount) == 0)
     141          if (ASMAtomicDecU32(&mRefCount) == 0)
    142142            {
    143143              STRING_STAT_INCREMENT(Free);
  • trunk/src/libs/xpcom18a4/xpcom/threads/nsThread.h

    r101960 r101967  
    5454#include "nsCOMPtr.h"
    5555
     56#include "prlock.h"
     57
    5658#include <iprt/thread.h>
    5759
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