Fix circular dependencies between optional, array_view, and rtc_base.

This splits things out of rtc_base and makes dependencies explicit.

Bug: webrtc:6828
Change-Id: Id521896c3c43595349021c857bec216e429a0c8d
Reviewed-on: https://webrtc-review.googlesource.com/32780
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21264}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 04bfe70..0c7e41c 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -87,6 +87,7 @@
     ":optional",
     ":rtc_stats_api",
     ":video_frame_api",
+    "../rtc_base:checks",
     "audio_codecs:audio_codecs_api",
 
     # Basically, don't add stuff here. You might break sensitive downstream
@@ -185,6 +186,7 @@
   ]
 
   deps = [
+    "../rtc_base:checks",
     "../rtc_base:rtc_base_approved",
   ]
 }
@@ -220,6 +222,7 @@
   ]
 
   deps = [
+    "../rtc_base:checks",
     "../rtc_base:rtc_base_approved",
   ]
 }
@@ -232,6 +235,7 @@
   deps = [
     ":video_frame_api",
     "$rtc_libyuv_dir",
+    "../rtc_base:checks",
     "../rtc_base:rtc_base_approved",
     "../system_wrappers",
   ]
@@ -242,7 +246,8 @@
     "array_view.h",
   ]
   deps = [
-    "../rtc_base:rtc_base_approved",
+    "../rtc_base:checks",
+    "../rtc_base:type_traits",
   ]
 }
 
@@ -253,7 +258,8 @@
   ]
   deps = [
     ":array_view",
-    "../rtc_base:rtc_base_approved",
+    "../rtc_base:checks",
+    "../rtc_base:sanitizer",
   ]
 }
 
@@ -325,6 +331,7 @@
       ":libjingle_peerconnection_api",
       "../api:peerconnection_and_implicit_call_api",
       "../media:rtc_media_base",
+      "../rtc_base:checks",
       "../rtc_base:rtc_base_approved",
     ]
     if (!build_with_chromium && is_clang) {
@@ -356,6 +363,7 @@
       ":libjingle_peerconnection_test_api",
       ":optional",
       ":ortc_api",
+      "../rtc_base:checks",
       "../rtc_base:rtc_base_approved",
       "../rtc_base:rtc_base_tests_utils",
       "../test:test_support",