Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Unified Diff: third_party/WebKit/Source/wtf/ThreadingPthreads.cpp

Issue 2191853002: Remove #if ENABLE(ASSERT) in bool MutexBase::locked(). Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
diff --git a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
index 2a7cdd110036cbfa22eba096616aef73a4b7b8b4..54e7b2f505f082c03fa81edfa5a732512482dd4b 100644
--- a/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
+++ b/third_party/WebKit/Source/wtf/ThreadingPthreads.cpp
@@ -110,9 +110,7 @@ MutexBase::MutexBase(bool recursive)
int result = pthread_mutex_init(&m_mutex.m_internalMutex, &attr);
ASSERT_UNUSED(result, !result);
-#if ENABLE(ASSERT)
m_mutex.m_recursionCount = 0;
-#endif
pthread_mutexattr_destroy(&attr);
}
@@ -127,17 +125,13 @@ void MutexBase::lock()
{
int result = pthread_mutex_lock(&m_mutex.m_internalMutex);
ASSERT_UNUSED(result, !result);
-#if ENABLE(ASSERT)
++m_mutex.m_recursionCount;
-#endif
}
void MutexBase::unlock()
{
-#if ENABLE(ASSERT)
ASSERT(m_mutex.m_recursionCount);
--m_mutex.m_recursionCount;
-#endif
int result = pthread_mutex_unlock(&m_mutex.m_internalMutex);
ASSERT_UNUSED(result, !result);
}
@@ -151,12 +145,10 @@ bool Mutex::tryLock()
{
int result = pthread_mutex_trylock(&m_mutex.m_internalMutex);
if (result == 0) {
-#if ENABLE(ASSERT)
// The Mutex class is not recursive, so the recursionCount should be
// zero after getting the lock.
ASSERT(!m_mutex.m_recursionCount);
++m_mutex.m_recursionCount;
-#endif
return true;
}
if (result == EBUSY)
@@ -170,9 +162,7 @@ bool RecursiveMutex::tryLock()
{
int result = pthread_mutex_trylock(&m_mutex.m_internalMutex);
if (result == 0) {
-#if ENABLE(ASSERT)
++m_mutex.m_recursionCount;
-#endif
return true;
}
if (result == EBUSY)
@@ -197,9 +187,7 @@ void ThreadCondition::wait(MutexBase& mutex)
PlatformMutex& platformMutex = mutex.impl();
int result = pthread_cond_wait(&m_condition, &platformMutex.m_internalMutex);
ASSERT_UNUSED(result, !result);
-#if ENABLE(ASSERT)
++platformMutex.m_recursionCount;
-#endif
}
bool ThreadCondition::timedWait(MutexBase& mutex, double absoluteTime)
@@ -221,9 +209,7 @@ bool ThreadCondition::timedWait(MutexBase& mutex, double absoluteTime)
PlatformMutex& platformMutex = mutex.impl();
int result = pthread_cond_timedwait(&m_condition, &platformMutex.m_internalMutex, &targetTime);
-#if ENABLE(ASSERT)
++platformMutex.m_recursionCount;
-#endif
return result == 0;
}

Powered by Google App Engine
This is Rietveld 408576698