Revert lock for logging to CriticalSection

This reverts commit I5b9d9036aa90eb0c652f6b17ea1162dea0362640

using spin lock (Global lock) for highly used lock may cause deadlock on ios

Bug: None
Change-Id: Ia7594d665bc17717299245b1a6cfcff18f273e77
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160200
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29857}
diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc
index 158be33..ff10c98 100644
--- a/rtc_base/logging.cc
+++ b/rtc_base/logging.cc
@@ -68,7 +68,7 @@
 }
 
 // Global lock for log subsystem, only needed to serialize access to streams_.
-ABSL_CONST_INIT GlobalLock g_log_crit;
+CriticalSection g_log_crit;
 }  // namespace
 
 // Inefficient default implementation, override is recommended.
@@ -201,7 +201,7 @@
 #endif
   }
 
-  GlobalLockScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit);
   for (LogSink* entry = streams_; entry != nullptr; entry = entry->next_) {
     if (severity_ >= entry->min_severity_) {
 #if defined(WEBRTC_ANDROID)
@@ -250,7 +250,7 @@
 
 void LogMessage::LogToDebug(LoggingSeverity min_sev) {
   g_dbg_sev = min_sev;
-  GlobalLockScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit);
   UpdateMinLogSeverity();
 }
 
@@ -259,7 +259,7 @@
 }
 
 int LogMessage::GetLogToStream(LogSink* stream) {
-  GlobalLockScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit);
   LoggingSeverity sev = LS_NONE;
   for (LogSink* entry = streams_; entry != nullptr; entry = entry->next_) {
     if (stream == nullptr || stream == entry) {
@@ -270,7 +270,7 @@
 }
 
 void LogMessage::AddLogToStream(LogSink* stream, LoggingSeverity min_sev) {
-  GlobalLockScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit);
   stream->min_severity_ = min_sev;
   stream->next_ = streams_;
   streams_ = stream;
@@ -278,7 +278,7 @@
 }
 
 void LogMessage::RemoveLogToStream(LogSink* stream) {
-  GlobalLockScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit);
   for (LogSink** entry = &streams_; *entry != nullptr;
        entry = &(*entry)->next_) {
     if (*entry == stream) {
@@ -447,7 +447,7 @@
   // TODO(tommi): We're grabbing this lock for every LogMessage instance that
   // is going to be logged. This introduces unnecessary synchronization for
   // a feature that's mostly used for testing.
-  GlobalLockScope cs(&g_log_crit);
+  CritScope cs(&g_log_crit);
   return streams_ == nullptr;
 }