Delete rtc::TryCritScope as unused
Bug: None Change-Id: I9288f26d22835fc4e8ee7e5da5acfa4b4b527d8a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/143163 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28389}
This commit is contained in:
parent
e8df482205
commit
2644a703cc
@ -210,23 +210,6 @@ CritScope::~CritScope() {
|
||||
cs_->Leave();
|
||||
}
|
||||
|
||||
TryCritScope::TryCritScope(const CriticalSection* cs)
|
||||
: cs_(cs), locked_(cs->TryEnter()) {
|
||||
CS_DEBUG_CODE(lock_was_called_ = false);
|
||||
RTC_UNUSED(lock_was_called_);
|
||||
}
|
||||
|
||||
TryCritScope::~TryCritScope() {
|
||||
CS_DEBUG_CODE(RTC_DCHECK(lock_was_called_));
|
||||
if (locked_)
|
||||
cs_->Leave();
|
||||
}
|
||||
|
||||
bool TryCritScope::locked() const {
|
||||
CS_DEBUG_CODE(lock_was_called_ = true);
|
||||
return locked_;
|
||||
}
|
||||
|
||||
void GlobalLockPod::Lock() {
|
||||
#if !defined(WEBRTC_WIN) && (!defined(WEBRTC_MAC) || USE_NATIVE_MUTEX_ON_MAC)
|
||||
const struct timespec ts_null = {0};
|
||||
|
||||
@ -102,31 +102,6 @@ class RTC_SCOPED_LOCKABLE CritScope {
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(CritScope);
|
||||
};
|
||||
|
||||
// Tries to lock a critical section on construction via
|
||||
// CriticalSection::TryEnter, and unlocks on destruction if the
|
||||
// lock was taken. Never blocks.
|
||||
//
|
||||
// IMPORTANT: Unlike CritScope, the lock may not be owned by this thread in
|
||||
// subsequent code. Users *must* check locked() to determine if the
|
||||
// lock was taken. If you're not calling locked(), you're doing it wrong!
|
||||
class TryCritScope {
|
||||
public:
|
||||
explicit TryCritScope(const CriticalSection* cs);
|
||||
~TryCritScope();
|
||||
#if defined(WEBRTC_WIN)
|
||||
_Check_return_ bool locked() const;
|
||||
#elif defined(WEBRTC_POSIX)
|
||||
bool locked() const __attribute__((__warn_unused_result__));
|
||||
#else // !defined(WEBRTC_WIN) && !defined(WEBRTC_POSIX)
|
||||
#error Unsupported platform.
|
||||
#endif
|
||||
private:
|
||||
const CriticalSection* const cs_;
|
||||
const bool locked_;
|
||||
mutable bool lock_was_called_; // Only used by RTC_DCHECKs.
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(TryCritScope);
|
||||
};
|
||||
|
||||
// A POD lock used to protect global variables. Do NOT use for other purposes.
|
||||
// No custom constructor or private data member should be added.
|
||||
class RTC_LOCKABLE GlobalLockPod {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user