Move CriticalSection into rtc_base_approved.
This class is being used from both libjingle and webrtc but we recently had a regression when we added dependency on libjingle's Thread class. This cleans that up and moves the implementation of CriticalSection and helper classes into the source file. I'm also improving debugging facilities and constness. BUG= R=magjed@webrtc.org Review URL: https://webrtc-codereview.appspot.com/51769004 Cr-Commit-Position: refs/heads/master@{#9089}
This commit is contained in:
@ -59,7 +59,7 @@ void MessageQueueManager::AddInternal(MessageQueue *message_queue) {
|
||||
// MessageQueueManager methods should be non-reentrant, so we
|
||||
// ASSERT that is the case. If any of these ASSERT, please
|
||||
// contact bpm or jbeda.
|
||||
#if CS_TRACK_OWNER // CurrentThreadIsOwner returns true by default.
|
||||
#if CS_DEBUG_CHECKS // CurrentThreadIsOwner returns true by default.
|
||||
ASSERT(!crit_.CurrentThreadIsOwner());
|
||||
#endif
|
||||
CritScope cs(&crit_);
|
||||
@ -73,7 +73,7 @@ void MessageQueueManager::Remove(MessageQueue *message_queue) {
|
||||
return Instance()->RemoveInternal(message_queue);
|
||||
}
|
||||
void MessageQueueManager::RemoveInternal(MessageQueue *message_queue) {
|
||||
#if CS_TRACK_OWNER // CurrentThreadIsOwner returns true by default.
|
||||
#if CS_DEBUG_CHECKS // CurrentThreadIsOwner returns true by default.
|
||||
ASSERT(!crit_.CurrentThreadIsOwner()); // See note above.
|
||||
#endif
|
||||
// If this is the last MessageQueue, destroy the manager as well so that
|
||||
@ -104,7 +104,7 @@ void MessageQueueManager::Clear(MessageHandler *handler) {
|
||||
return Instance()->ClearInternal(handler);
|
||||
}
|
||||
void MessageQueueManager::ClearInternal(MessageHandler *handler) {
|
||||
#if CS_TRACK_OWNER // CurrentThreadIsOwner returns true by default.
|
||||
#if CS_DEBUG_CHECKS // CurrentThreadIsOwner returns true by default.
|
||||
ASSERT(!crit_.CurrentThreadIsOwner()); // See note above.
|
||||
#endif
|
||||
CritScope cs(&crit_);
|
||||
|
||||
Reference in New Issue
Block a user