Ensure task queues delete closures in task queue context.

Bug: webrtc:14449
Change-Id: I90d09d35398c1f8817701662f51cbc6a684a2fe0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/275773
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38917}
diff --git a/api/task_queue/task_queue_base.h b/api/task_queue/task_queue_base.h
index a2cff9c..f78600d 100644
--- a/api/task_queue/task_queue_base.h
+++ b/api/task_queue/task_queue_base.h
@@ -51,10 +51,16 @@
 
   // Schedules a `task` to execute. Tasks are executed in FIFO order.
   // When a TaskQueue is deleted, pending tasks will not be executed but they
-  // will be deleted. The deletion of tasks may happen synchronously on the
-  // TaskQueue or it may happen asynchronously after TaskQueue is deleted.
-  // This may vary from one implementation to the next so assumptions about
-  // lifetimes of pending tasks should not be made.
+  // will be deleted.
+  //
+  // As long as tasks are not posted from task destruction, posted tasks are
+  // guaranteed to be destroyed with Current() pointing to the task queue they
+  // were posted to, whether they're executed or not. That means SequenceChecker
+  // works during task destruction, a fact that can be used to guarantee
+  // thread-compatible object deletion happening on a particular task queue
+  // which can simplify class design.
+  // Note that this guarantee does not apply to delayed tasks.
+  //
   // May be called on any thread or task queue, including this task queue.
   virtual void PostTask(absl::AnyInvocable<void() &&> task) = 0;