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

Side by Side Diff: webrtc/base/criticalsection.cc

Issue 2128583003: Remove unused CriticalSection::IsLocked() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.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 unified diff | Download patch
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | webrtc/base/criticalsection_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 reinterpret_cast<HANDLE>(static_cast<size_t>(GetCurrentThreadId())); 173 reinterpret_cast<HANDLE>(static_cast<size_t>(GetCurrentThreadId()));
174 #else 174 #else
175 #if CS_DEBUG_CHECKS 175 #if CS_DEBUG_CHECKS
176 return IsThreadRefEqual(thread_, CurrentThreadRef()); 176 return IsThreadRefEqual(thread_, CurrentThreadRef());
177 #else 177 #else
178 return true; 178 return true;
179 #endif // CS_DEBUG_CHECKS 179 #endif // CS_DEBUG_CHECKS
180 #endif 180 #endif
181 } 181 }
182 182
183 bool CriticalSection::IsLocked() const {
184 #if defined(WEBRTC_WIN)
185 return crit_.LockCount != -1;
186 #else
187 #if CS_DEBUG_CHECKS
188 return thread_ != 0;
189 #else
190 return true;
191 #endif
192 #endif
193 }
194
195 CritScope::CritScope(const CriticalSection* cs) : cs_(cs) { cs_->Enter(); } 183 CritScope::CritScope(const CriticalSection* cs) : cs_(cs) { cs_->Enter(); }
196 CritScope::~CritScope() { cs_->Leave(); } 184 CritScope::~CritScope() { cs_->Leave(); }
197 185
198 TryCritScope::TryCritScope(const CriticalSection* cs) 186 TryCritScope::TryCritScope(const CriticalSection* cs)
199 : cs_(cs), locked_(cs->TryEnter()) { 187 : cs_(cs), locked_(cs->TryEnter()) {
200 CS_DEBUG_CODE(lock_was_called_ = false); 188 CS_DEBUG_CODE(lock_was_called_ = false);
201 } 189 }
202 190
203 TryCritScope::~TryCritScope() { 191 TryCritScope::~TryCritScope() {
204 CS_DEBUG_CODE(RTC_DCHECK(lock_was_called_)); 192 CS_DEBUG_CODE(RTC_DCHECK(lock_was_called_));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 GlobalLockScope::GlobalLockScope(GlobalLockPod* lock) 227 GlobalLockScope::GlobalLockScope(GlobalLockPod* lock)
240 : lock_(lock) { 228 : lock_(lock) {
241 lock_->Lock(); 229 lock_->Lock();
242 } 230 }
243 231
244 GlobalLockScope::~GlobalLockScope() { 232 GlobalLockScope::~GlobalLockScope() {
245 lock_->Unlock(); 233 lock_->Unlock();
246 } 234 }
247 235
248 } // namespace rtc 236 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/criticalsection.h ('k') | webrtc/base/criticalsection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698