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-Commit-Position: refs/heads/master@{#19487}
This commit is contained in:
eladalon 2017-08-24 05:04:56 -07:00 committed by Commit Bot
parent a4955b4d9a
commit cff98dc2d6
2 changed files with 6 additions and 1 deletions

View File

@ -94,6 +94,7 @@ void DirectTransport::SetConfig(const FakeNetworkPipe::Config& config) {
}
void DirectTransport::StopSending() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_);
task_queue_->CancelTask(next_scheduled_task_);
}

View File

@ -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 @@ class PacketReceiver;
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 @@ class DirectTransport : public Transport {
// 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_;