Make MessageQueue processing an optional feature of FakeClock

This is used to avoid thread processing in simulated time
controller. This saves up to 30% execution time in debug builds.

Bug: webrtc:10365
Change-Id: Ie83dfb2468d371e4687d28c776acf7e23eb411d1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133173
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27666}
This commit is contained in:
Sebastian Jansson
2019-04-17 10:36:03 +02:00
committed by Commit Bot
parent 8a7dcb163e
commit d624c3903c
12 changed files with 82 additions and 48 deletions

View File

@ -48,7 +48,8 @@ class TestClient : public sigslot::has_slots<> {
// Create a test client that will use a fake clock. NextPacket needs to wait
// for a packet to be received, and thus it needs to advance the fake clock
// if the test is using one, rather than just sleeping.
TestClient(std::unique_ptr<AsyncPacketSocket> socket, FakeClock* fake_clock);
TestClient(std::unique_ptr<AsyncPacketSocket> socket,
ThreadProcessingFakeClock* fake_clock);
~TestClient() override;
SocketAddress address() const { return socket_->GetLocalAddress(); }
@ -102,7 +103,7 @@ class TestClient : public sigslot::has_slots<> {
bool CheckTimestamp(int64_t packet_timestamp);
void AdvanceTime(int ms);
FakeClock* fake_clock_ = nullptr;
ThreadProcessingFakeClock* fake_clock_ = nullptr;
CriticalSection crit_;
std::unique_ptr<AsyncPacketSocket> socket_;
std::vector<std::unique_ptr<Packet>> packets_;