Allow link-time injection of the DefaultTaskQueueFactory

Bug: webrtc:10191
Change-Id: If6a2fb32bee63328cf2cb86be2aac69bc5bd65dd
Reviewed-on: https://webrtc-review.googlesource.com/c/120964
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26552}
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 69f2133..8884bd3 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -63,20 +63,25 @@
   # supported platforms.
   visibility = [ ":global_task_queue_factory" ]
   sources = [
-    "default_task_queue_factory.cc",
     "default_task_queue_factory.h",
   ]
   deps = [
     ":task_queue_factory",
-    "../../rtc_base:checks",
   ]
+
+  # TODO(bugs.webrtc.org/10284): Include implementation unconditionally when
+  # global task queue factory is removed.
+  if (rtc_link_task_queue_impl) {
+    sources += [ "default_task_queue_factory.cc" ]
+    deps += [ "../../rtc_base:checks" ]
+  }
 }
 
 # Linking with global_task_queue_factory adds link-time implementation of the
 # rtc::TaskQueue that allows run-time injection of the TaskQueue implementaion.
 rtc_source_set("global_task_queue_factory") {
-  # TODO(danilchap): Remove this target when task queue factory propagated to
-  # all components that create TaskQueues.
+  # TODO(bugs.webrtc.org/10284): Remove this target when task queue factory
+  # propagated to all components that create TaskQueues.
   visibility = [ "*" ]
   sources = [
     "global_task_queue_factory.cc",