Delete method MessageQueue::set_socketserver
Instead, make the pointer to the associated socket server a
construction time const, and delete its lock.
Introduces a helper class AutoSocketServerThread for code
(mainly tests) which need a socket server associated with
the current thread.
BUG=webrtc:7501
Review-Url: https://codereview.webrtc.org/2828223002
Cr-Commit-Position: refs/heads/master@{#18047}
diff --git a/webrtc/base/virtualsocket_unittest.cc b/webrtc/base/virtualsocket_unittest.cc
index 488cada..54a52d9 100644
--- a/webrtc/base/virtualsocket_unittest.cc
+++ b/webrtc/base/virtualsocket_unittest.cc
@@ -147,6 +147,7 @@
public:
VirtualSocketServerTest()
: ss_(nullptr),
+ thread_(&ss_),
kIPv4AnyAddress(IPAddress(INADDR_ANY), 0),
kIPv6AnyAddress(IPAddress(in6addr_any), 0) {}
@@ -828,10 +829,8 @@
}
protected:
- virtual void SetUp() { Thread::Current()->set_socketserver(&ss_); }
- virtual void TearDown() { Thread::Current()->set_socketserver(nullptr); }
-
VirtualSocketServer ss_;
+ AutoSocketServerThread thread_;
const SocketAddress kIPv4AnyAddress;
const SocketAddress kIPv6AnyAddress;
};