OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #ifndef WEBRTC_TEST_DIRECT_TRANSPORT_H_ | 10 #ifndef WEBRTC_TEST_DIRECT_TRANSPORT_H_ |
11 #define WEBRTC_TEST_DIRECT_TRANSPORT_H_ | 11 #define WEBRTC_TEST_DIRECT_TRANSPORT_H_ |
12 | 12 |
13 #include <assert.h> | 13 #include <assert.h> |
14 | 14 |
15 #include <memory> | 15 #include <memory> |
16 | 16 |
17 #include "webrtc/api/call/transport.h" | 17 #include "webrtc/api/call/transport.h" |
18 #include "webrtc/call/call.h" | 18 #include "webrtc/call/call.h" |
19 #include "webrtc/rtc_base/sequenced_task_checker.h" | 19 #include "webrtc/rtc_base/sequenced_task_checker.h" |
| 20 #include "webrtc/rtc_base/thread_annotations.h" |
20 #include "webrtc/test/fake_network_pipe.h" | 21 #include "webrtc/test/fake_network_pipe.h" |
21 #include "webrtc/test/single_threaded_task_queue.h" | 22 #include "webrtc/test/single_threaded_task_queue.h" |
22 | 23 |
23 namespace webrtc { | 24 namespace webrtc { |
24 | 25 |
25 class Clock; | 26 class Clock; |
26 class PacketReceiver; | 27 class PacketReceiver; |
27 | 28 |
28 namespace test { | 29 namespace test { |
29 | 30 |
| 31 // Objects of this class are expected to be allocated and destroyed on the |
| 32 // same task-queue - the one that's passed in via the constructor. |
30 class DirectTransport : public Transport { | 33 class DirectTransport : public Transport { |
31 public: | 34 public: |
32 RTC_DEPRECATED DirectTransport( | 35 RTC_DEPRECATED DirectTransport( |
33 Call* send_call, | 36 Call* send_call, |
34 const std::map<uint8_t, MediaType>& payload_type_map); | 37 const std::map<uint8_t, MediaType>& payload_type_map); |
35 RTC_DEPRECATED DirectTransport( | 38 RTC_DEPRECATED DirectTransport( |
36 const FakeNetworkPipe::Config& config, | 39 const FakeNetworkPipe::Config& config, |
37 Call* send_call, | 40 Call* send_call, |
38 const std::map<uint8_t, MediaType>& payload_type_map); | 41 const std::map<uint8_t, MediaType>& payload_type_map); |
39 RTC_DEPRECATED DirectTransport( | 42 RTC_DEPRECATED DirectTransport( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 }; | 98 }; |
96 | 99 |
97 void SendPackets(); | 100 void SendPackets(); |
98 | 101 |
99 Call* const send_call_; | 102 Call* const send_call_; |
100 Clock* const clock_; | 103 Clock* const clock_; |
101 | 104 |
102 // TODO(eladalon): Make |task_queue_| const. | 105 // TODO(eladalon): Make |task_queue_| const. |
103 // https://bugs.chromium.org/p/webrtc/issues/detail?id=8125 | 106 // https://bugs.chromium.org/p/webrtc/issues/detail?id=8125 |
104 SingleThreadedTaskQueueForTesting* task_queue_; | 107 SingleThreadedTaskQueueForTesting* task_queue_; |
105 SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_; | 108 SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_ |
| 109 GUARDED_BY(&sequence_checker_); |
106 | 110 |
107 FakeNetworkPipe fake_network_; | 111 FakeNetworkPipe fake_network_; |
108 | 112 |
109 rtc::SequencedTaskChecker sequence_checker_; | 113 rtc::SequencedTaskChecker sequence_checker_; |
110 | 114 |
111 // TODO(eladalon): https://bugs.chromium.org/p/webrtc/issues/detail?id=8125 | 115 // TODO(eladalon): https://bugs.chromium.org/p/webrtc/issues/detail?id=8125 |
112 // Deprecated versions of the ctor don't get the task queue passed in from | 116 // Deprecated versions of the ctor don't get the task queue passed in from |
113 // outside. We'll create one locally for them. This is deprecated, and will | 117 // outside. We'll create one locally for them. This is deprecated, and will |
114 // be removed as soon as the need for those ctors is removed. | 118 // be removed as soon as the need for those ctors is removed. |
115 std::unique_ptr<SingleThreadedTaskQueueForTesting> deprecated_task_queue_; | 119 std::unique_ptr<SingleThreadedTaskQueueForTesting> deprecated_task_queue_; |
116 }; | 120 }; |
117 } // namespace test | 121 } // namespace test |
118 } // namespace webrtc | 122 } // namespace webrtc |
119 | 123 |
120 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_ | 124 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_ |
OLD | NEW |