diff --git a/webrtc/base/criticalsection.cc b/webrtc/base/criticalsection.cc index 63582ebae8..b15bb82ef4 100644 --- a/webrtc/base/criticalsection.cc +++ b/webrtc/base/criticalsection.cc @@ -180,18 +180,6 @@ bool CriticalSection::CurrentThreadIsOwner() const { #endif } -bool CriticalSection::IsLocked() const { -#if defined(WEBRTC_WIN) - return crit_.LockCount != -1; -#else -#if CS_DEBUG_CHECKS - return thread_ != 0; -#else - return true; -#endif -#endif -} - CritScope::CritScope(const CriticalSection* cs) : cs_(cs) { cs_->Enter(); } CritScope::~CritScope() { cs_->Leave(); } diff --git a/webrtc/base/criticalsection.h b/webrtc/base/criticalsection.h index 49c97a07ac..b06436f759 100644 --- a/webrtc/base/criticalsection.h +++ b/webrtc/base/criticalsection.h @@ -63,8 +63,6 @@ class LOCKABLE CriticalSection { // Use only for RTC_DCHECKing. bool CurrentThreadIsOwner() const; - // Use only for RTC_DCHECKing. - bool IsLocked() const; private: #if defined(WEBRTC_WIN) diff --git a/webrtc/base/criticalsection_unittest.cc b/webrtc/base/criticalsection_unittest.cc index fb38737c9a..42679d987f 100644 --- a/webrtc/base/criticalsection_unittest.cc +++ b/webrtc/base/criticalsection_unittest.cc @@ -306,23 +306,6 @@ TEST(CriticalSectionTest, Basic) { EXPECT_EQ(0, runner.shared_value()); } -#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) -TEST(CriticalSectionTest, IsLocked) { - // Simple single-threaded test of IsLocked. - CriticalSection cs; - EXPECT_FALSE(cs.IsLocked()); - cs.Enter(); - EXPECT_TRUE(cs.IsLocked()); - cs.Leave(); - EXPECT_FALSE(cs.IsLocked()); - if (!cs.TryEnter()) - FAIL(); - EXPECT_TRUE(cs.IsLocked()); - cs.Leave(); - EXPECT_FALSE(cs.IsLocked()); -} -#endif - class PerfTestData { public: PerfTestData(int expected_count, Event* event)