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

Unified Diff: webrtc/base/criticalsection.cc

Issue 1611223002: Make rtc::CriticalSection lockable from f() const. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: comment Created 4 years, 11 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
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/criticalsection.cc
diff --git a/webrtc/base/criticalsection.cc b/webrtc/base/criticalsection.cc
index 1f50c2355dbcef57b016f31dcc8c68501b9a84ca..2c6b100a7dfdfa4c92e179f54f58ba2eea54e40c 100644
--- a/webrtc/base/criticalsection.cc
+++ b/webrtc/base/criticalsection.cc
@@ -36,7 +36,7 @@ CriticalSection::~CriticalSection() {
#endif
}
-void CriticalSection::Enter() EXCLUSIVE_LOCK_FUNCTION() {
+void CriticalSection::Enter() const EXCLUSIVE_LOCK_FUNCTION() {
#if defined(WEBRTC_WIN)
EnterCriticalSection(&crit_);
#else
@@ -53,7 +53,7 @@ void CriticalSection::Enter() EXCLUSIVE_LOCK_FUNCTION() {
#endif
}
-bool CriticalSection::TryEnter() EXCLUSIVE_TRYLOCK_FUNCTION(true) {
+bool CriticalSection::TryEnter() const EXCLUSIVE_TRYLOCK_FUNCTION(true) {
#if defined(WEBRTC_WIN)
return TryEnterCriticalSection(&crit_) != FALSE;
#else
@@ -71,7 +71,7 @@ bool CriticalSection::TryEnter() EXCLUSIVE_TRYLOCK_FUNCTION(true) {
return true;
#endif
}
-void CriticalSection::Leave() UNLOCK_FUNCTION() {
+void CriticalSection::Leave() const UNLOCK_FUNCTION() {
RTC_DCHECK(CurrentThreadIsOwner());
#if defined(WEBRTC_WIN)
LeaveCriticalSection(&crit_);
@@ -115,10 +115,10 @@ bool CriticalSection::IsLocked() const {
#endif
}
-CritScope::CritScope(CriticalSection* cs) : cs_(cs) { cs_->Enter(); }
+CritScope::CritScope(const CriticalSection* cs) : cs_(cs) { cs_->Enter(); }
CritScope::~CritScope() { cs_->Leave(); }
-TryCritScope::TryCritScope(CriticalSection* cs)
+TryCritScope::TryCritScope(const CriticalSection* cs)
: cs_(cs), locked_(cs->TryEnter()) {
CS_DEBUG_CODE(lock_was_called_ = false);
}
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698