Delete use of AsyncInvoker from FakePacketTransport

Bug: webrtc:12339
Change-Id: Ia9a5568b576b9a95ed9e1326f38fb68a8581dc88
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211981
Reviewed-by: Taylor <deadbeef@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33499}
This commit is contained in:
Niels Möller 2021-03-15 17:10:21 +01:00 committed by Commit Bot
parent cbadb8bcab
commit 035747712f

View File

@ -15,7 +15,6 @@
#include <string>
#include "p2p/base/packet_transport_internal.h"
#include "rtc_base/async_invoker.h"
#include "rtc_base/copy_on_write_buffer.h"
namespace rtc {
@ -31,11 +30,6 @@ class FakePacketTransport : public PacketTransportInternal {
}
}
// If async, will send packets by "Post"-ing to message queue instead of
// synchronously "Send"-ing.
void SetAsync(bool async) { async_ = async; }
void SetAsyncDelay(int delay_ms) { async_delay_ms_ = delay_ms; }
// SetWritable, SetReceiving and SetDestination are the main methods that can
// be used for testing, to simulate connectivity or lack thereof.
void SetWritable(bool writable) { set_writable(writable); }
@ -70,13 +64,8 @@ class FakePacketTransport : public PacketTransportInternal {
return -1;
}
CopyOnWriteBuffer packet(data, len);
if (async_) {
invoker_.AsyncInvokeDelayed<void>(
RTC_FROM_HERE, Thread::Current(),
[this, packet] { SendPacketInternal(packet); }, async_delay_ms_);
} else {
SendPacketInternal(packet);
}
SendPacketInternal(packet);
SentPacket sent_packet(options.packet_id, TimeMillis());
SignalSentPacket(this, sent_packet);
return static_cast<int>(len);
@ -138,11 +127,8 @@ class FakePacketTransport : public PacketTransportInternal {
}
CopyOnWriteBuffer last_sent_packet_;
AsyncInvoker invoker_;
std::string transport_name_;
FakePacketTransport* dest_ = nullptr;
bool async_ = false;
int async_delay_ms_ = 0;
bool writable_ = false;
bool receiving_ = false;