VirtualBox

Changeset 101917 in vbox


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

libs/xpcom: Convert nsObserverList.{cpp,h} to use an IPRT fast mutex, bugref:10545

Location:
trunk/src/libs/xpcom18a4/xpcom/ds
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsObserverList.cpp

    r1 r101917  
    4949{
    5050    MOZ_COUNT_CTOR(nsObserverList);
    51     mLock = PR_NewLock();
     51    int vrc = RTSemFastMutexCreate(&m_hLock);
     52    AssertRC(vrc); RT_NOREF(vrc);
    5253}
    5354
     
    5556{
    5657    MOZ_COUNT_DTOR(nsObserverList);
    57     PR_DestroyLock(mLock);
     58    int vrc = RTSemFastMutexDestroy(m_hLock);
     59    AssertRC(vrc); RT_NOREF(vrc);
    5860}
    5961
     
    6668    NS_ENSURE_ARG(anObserver);
    6769
    68     nsAutoLock lock(mLock);
     70    nsAutoLock lock(m_hLock);
    6971
    7072    if (!mObserverList) {
     
    106108    NS_ENSURE_ARG(anObserver);
    107109
    108     nsAutoLock lock(mLock);
     110    nsAutoLock lock(m_hLock);
    109111
    110112    if (!mObserverList)
     
    135137nsObserverList::GetObserverList(nsISimpleEnumerator** anEnumerator)
    136138{
    137     nsAutoLock lock(mLock);
     139    nsAutoLock lock(m_hLock);
    138140
    139141    ObserverListEnumerator * enumerator= new ObserverListEnumerator(mObserverList);
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsObserverList.h

    r1 r101917  
    6464{
    6565public:
    66   nsObserverList();
    67   ~nsObserverList();
     66    nsObserverList();
     67    ~nsObserverList();
    6868
    69   nsresult AddObserver(nsIObserver* anObserver, PRBool ownsWeak);
    70   nsresult RemoveObserver(nsIObserver* anObserver);
    71   nsresult GetObserverList(nsISimpleEnumerator** anEnumerator);
    72      
     69    nsresult AddObserver(nsIObserver* anObserver, PRBool ownsWeak);
     70    nsresult RemoveObserver(nsIObserver* anObserver);
     71    nsresult GetObserverList(nsISimpleEnumerator** anEnumerator);
     72
    7373protected:
    74   PRLock* mLock;
    75   nsCOMPtr<nsISupportsArray>  mObserverList;
     74    RTSEMFASTMUTEX              m_hLock;
     75    nsCOMPtr<nsISupportsArray>  mObserverList;
    7676};
    7777
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