Get rid of thread_darwin file.

This file has been causing problems for the build. ObjC was required for
a few methods because autoreleasepools are necessary on new threads if
those threads will be running objc code.

This CL introduces a workaround by using ObjC runtime C APIs to create
and drain autoreleasepools, but this comes with the cost of relying on
an internal API that may break on future OS/clang releases.

Bug: webrtc:9838
Change-Id: I18e765020c20c096c9ef8d80dfa82375ecb202ff
Reviewed-on: https://webrtc-review.googlesource.com/c/105301
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25141}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index f7f5bb8..2580d46 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -692,29 +692,11 @@
   if (!build_with_mozilla) {
     public_deps += [ ":rtc_base_generic" ]
   }
-  if (is_win) {
+  if (is_win || is_mac || is_ios) {
     sources = [
       "noop.cc",
     ]
   }
-  if (is_ios || is_mac) {
-    sources = [
-      "noop.mm",
-    ]
-    public_deps += [ ":rtc_base_objc" ]
-  }
-}
-
-if (is_ios || is_mac) {
-  rtc_source_set("rtc_base_objc") {
-    sources = [
-      "thread_darwin.mm",
-    ]
-    deps = [
-      ":rtc_base_generic",
-    ]
-    visibility = [ ":rtc_base" ]
-  }
 }
 
 rtc_static_library("rtc_base_generic") {
@@ -894,6 +876,7 @@
 
   if (is_ios || is_mac) {
     sources += [ "macifaddrs_converter.cc" ]
+    deps += [ "system:cocoa_threading" ]
   }
 
   if (rtc_use_x11) {