Allow absl::Nonnull and absl::Nullable.

This CL includes follow-up changes from
https://webrtc-review.googlesource.com/c/src/+/324280

Bug: none
Change-Id: I6abad16e05cac7197c51ffa7b1d3fb991843df6e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/325243
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41030}
diff --git a/DEPS b/DEPS
index a98e19d..4575918 100644
--- a/DEPS
+++ b/DEPS
@@ -2602,6 +2602,7 @@
   "+absl/base/attributes.h",
   "+absl/base/config.h",
   "+absl/base/const_init.h",
+  "+absl/base/nullability.h",
   "+absl/base/macros.h",
   "+absl/cleanup/cleanup.h",
   "+absl/container/inlined_vector.h",
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 527fac4..e0e2e50 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -132,7 +132,10 @@
     "../../rtc_base/system:no_unique_address",
     "../../rtc_base/system:rtc_export",
   ]
-  absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
+  absl_deps = [
+    "//third_party/abseil-cpp/absl/base:nullability",
+    "//third_party/abseil-cpp/absl/functional:any_invocable",
+  ]
 }
 
 if (rtc_include_tests) {
diff --git a/api/task_queue/pending_task_safety_flag.cc b/api/task_queue/pending_task_safety_flag.cc
index 3145550..4d8fc2b 100644
--- a/api/task_queue/pending_task_safety_flag.cc
+++ b/api/task_queue/pending_task_safety_flag.cc
@@ -37,7 +37,8 @@
 rtc::scoped_refptr<PendingTaskSafetyFlag>
 PendingTaskSafetyFlag::CreateAttachedToTaskQueue(
     bool alive,
-    TaskQueueBase* attached_queue) {
+    absl::Nonnull<TaskQueueBase*> attached_queue) {
+  RTC_DCHECK(attached_queue) << "Null TaskQueue provided";
   return rtc::scoped_refptr<PendingTaskSafetyFlag>(
       new PendingTaskSafetyFlag(alive, attached_queue));
 }
diff --git a/api/task_queue/pending_task_safety_flag.h b/api/task_queue/pending_task_safety_flag.h
index b601b94..12b1e00 100644
--- a/api/task_queue/pending_task_safety_flag.h
+++ b/api/task_queue/pending_task_safety_flag.h
@@ -13,6 +13,7 @@
 
 #include <utility>
 
+#include "absl/base/nullability.h"
 #include "absl/functional/any_invocable.h"
 #include "api/ref_counted_base.h"
 #include "api/scoped_refptr.h"
@@ -72,7 +73,7 @@
   // a given task queue and the `alive()` flag specified.
   static rtc::scoped_refptr<PendingTaskSafetyFlag> CreateAttachedToTaskQueue(
       bool alive,
-      TaskQueueBase* attached_queue);
+      absl::Nonnull<TaskQueueBase*> attached_queue);
 
   // Same as `CreateDetached()` except the initial state of the returned flag
   // will be `!alive()`.
@@ -101,7 +102,8 @@
 
  protected:
   explicit PendingTaskSafetyFlag(bool alive) : alive_(alive) {}
-  PendingTaskSafetyFlag(bool alive, TaskQueueBase* attached_queue)
+  PendingTaskSafetyFlag(bool alive,
+                        absl::Nonnull<TaskQueueBase*> attached_queue)
       : alive_(alive), main_sequence_(attached_queue) {}
 
  private:
diff --git a/g3doc/abseil-in-webrtc.md b/g3doc/abseil-in-webrtc.md
index 32fc42d..034f6c2 100644
--- a/g3doc/abseil-in-webrtc.md
+++ b/g3doc/abseil-in-webrtc.md
@@ -29,6 +29,7 @@
 * `absl::bind_front`
 * `absl::Cleanup`
 * `absl::InlinedVector`
+* `absl::Nonnull` and `absl::Nullable`
 * `absl::WrapUnique`
 * `absl::optional` and related stuff from `absl/types/optional.h`.
 * `absl::string_view`