Ignore:
Timestamp:
Jul 27, 2009, 3:07:26 PM (16 years ago)
Author:
[email protected]
Message:

Reviewed by Darin Adler.

https://bugs.webkit.org/show_bug.cgi?id=27735
Give a helpful name to JSLock constructor argument

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSLock.cpp

    r44224 r46431  
    6161
    6262JSLock::JSLock(ExecState* exec)
    63     : m_lockingForReal(exec->globalData().isSharedInstance)
    64 {
    65     lock(m_lockingForReal);
    66 }
    67 
    68 void JSLock::lock(bool lockForReal)
     63    : m_lockBehavior(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly)
     64{
     65    lock(m_lockBehavior);
     66}
     67
     68void JSLock::lock(JSLockBehavior lockBehavior)
    6969{
    7070#ifdef NDEBUG
    7171    // Locking "not for real" is a debug-only feature.
    72     if (!lockForReal)
     72    if (lockBehavior == SilenceAssertionsOnly)
    7373        return;
    7474#endif
     
    7777
    7878    intptr_t currentLockCount = lockCount();
    79     if (!currentLockCount && lockForReal) {
     79    if (!currentLockCount && lockBehavior == LockForReal) {
    8080        int result;
    8181        result = pthread_mutex_lock(&JSMutex);
     
    8585}
    8686
    87 void JSLock::unlock(bool lockForReal)
     87void JSLock::unlock(JSLockBehavior lockBehavior)
    8888{
    8989    ASSERT(lockCount());
     
    9191#ifdef NDEBUG
    9292    // Locking "not for real" is a debug-only feature.
    93     if (!lockForReal)
     93    if (lockBehavior == SilenceAssertionsOnly)
    9494        return;
    9595#endif
     
    9797    intptr_t newLockCount = lockCount() - 1;
    9898    setLockCount(newLockCount);
    99     if (!newLockCount && lockForReal) {
     99    if (!newLockCount && lockBehavior == LockForReal) {
    100100        int result;
    101101        result = pthread_mutex_unlock(&JSMutex);
     
    106106void JSLock::lock(ExecState* exec)
    107107{
    108     lock(exec->globalData().isSharedInstance);
     108    lock(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly);
    109109}
    110110
    111111void JSLock::unlock(ExecState* exec)
    112112{
    113     unlock(exec->globalData().isSharedInstance);
     113    unlock(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly);
    114114}
    115115
     
    163163
    164164JSLock::DropAllLocks::DropAllLocks(ExecState* exec)
    165     : m_lockingForReal(exec->globalData().isSharedInstance)
     165    : m_lockBehavior(exec->globalData().isSharedInstance ? LockForReal : SilenceAssertionsOnly)
    166166{
    167167    pthread_once(&createJSLockCountOnce, createJSLockCount);
     
    174174    m_lockCount = JSLock::lockCount();
    175175    for (intptr_t i = 0; i < m_lockCount; i++)
    176         JSLock::unlock(m_lockingForReal);
    177 }
    178 
    179 JSLock::DropAllLocks::DropAllLocks(bool lockingForReal)
    180     : m_lockingForReal(lockingForReal)
     176        JSLock::unlock(m_lockBehavior);
     177}
     178
     179JSLock::DropAllLocks::DropAllLocks(JSLockBehavior JSLockBehavior)
     180    : m_lockBehavior(JSLockBehavior)
    181181{
    182182    pthread_once(&createJSLockCountOnce, createJSLockCount);
     
    192192    m_lockCount = JSLock::lockCount();
    193193    for (intptr_t i = 0; i < m_lockCount; i++)
    194         JSLock::unlock(m_lockingForReal);
     194        JSLock::unlock(m_lockBehavior);
    195195}
    196196
     
    198198{
    199199    for (intptr_t i = 0; i < m_lockCount; i++)
    200         JSLock::lock(m_lockingForReal);
     200        JSLock::lock(m_lockBehavior);
    201201
    202202    --lockDropDepth;
     
    206206
    207207JSLock::JSLock(ExecState*)
    208     : m_lockingForReal(false)
     208    : m_lockBehavior(false)
    209209{
    210210}
     
    222222}
    223223
    224 void JSLock::lock(bool)
    225 {
    226 }
    227 
    228 void JSLock::unlock(bool)
     224void JSLock::lock(JSLockBehavior)
     225{
     226}
     227
     228void JSLock::unlock(JSLockBehavior)
    229229{
    230230}
     
    242242}
    243243
    244 JSLock::DropAllLocks::DropAllLocks(bool)
     244JSLock::DropAllLocks::DropAllLocks(JSLockBehavior)
    245245{
    246246}
Note: See TracChangeset for help on using the changeset viewer.