Add GUARDED_BY in DirectTransport

Add GUARDED_BY annotation to DirectTransport to demonstrate that next_scheduled_task_ is properly protected.
SendRtp(), SendRtcp(), etc., remain as unprotected as they were before the migration from using a thread to using a task-queue.

BUG=webrtc:8113
TBR=stefan@webrtc.org

Review-Url: https://codereview.webrtc.org/3002163003
Cr-Original-Commit-Position: refs/heads/master@{#19487}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: cff98dc2d6a4239fee83f90c9f48e86382f4e244
diff --git a/test/direct_transport.cc b/test/direct_transport.cc
index 81f3b69..e955c08 100644
--- a/test/direct_transport.cc
+++ b/test/direct_transport.cc
@@ -94,6 +94,7 @@
 }
 
 void DirectTransport::StopSending() {
+  RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
   task_queue_->CancelTask(next_scheduled_task_);
 }
 
diff --git a/test/direct_transport.h b/test/direct_transport.h
index 93ba971..4be00a7 100644
--- a/test/direct_transport.h
+++ b/test/direct_transport.h
@@ -17,6 +17,7 @@
 #include "webrtc/api/call/transport.h"
 #include "webrtc/call/call.h"
 #include "webrtc/rtc_base/sequenced_task_checker.h"
+#include "webrtc/rtc_base/thread_annotations.h"
 #include "webrtc/test/fake_network_pipe.h"
 #include "webrtc/test/single_threaded_task_queue.h"
 
@@ -27,6 +28,8 @@
 
 namespace test {
 
+// Objects of this class are expected to be allocated and destroyed  on the
+// same task-queue - the one that's passed in via the constructor.
 class DirectTransport : public Transport {
  public:
   RTC_DEPRECATED DirectTransport(
@@ -102,7 +105,8 @@
   // TODO(eladalon): Make |task_queue_| const.
   // https://bugs.chromium.org/p/webrtc/issues/detail?id=8125
   SingleThreadedTaskQueueForTesting* task_queue_;
-  SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_;
+  SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_
+      GUARDED_BY(&sequence_checker_);
 
   FakeNetworkPipe fake_network_;