Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: webrtc/base/thread.cc

Issue 2828223002: Delete method MessageQueue::set_socketserver (Closed)
Patch Set: Fix memory leak in SSLAdapterTestBase. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/thread.h ('k') | webrtc/base/virtualsocket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/thread.cc
diff --git a/webrtc/base/thread.cc b/webrtc/base/thread.cc
index 9a71c1aa3fd352130677641d54b2ff8a79ce5d96..1be5196c7dffbf8325b679c1504f19df1eb7f2b3 100644
--- a/webrtc/base/thread.cc
+++ b/webrtc/base/thread.cc
@@ -528,4 +528,26 @@ AutoThread::~AutoThread() {
}
}
+AutoSocketServerThread::AutoSocketServerThread(SocketServer* ss)
+ : Thread(ss) {
+ old_thread_ = ThreadManager::Instance()->CurrentThread();
+ rtc::ThreadManager::Instance()->SetCurrentThread(this);
+ if (old_thread_) {
+ MessageQueueManager::Remove(old_thread_);
+ }
+}
+
+AutoSocketServerThread::~AutoSocketServerThread() {
+ RTC_DCHECK(ThreadManager::Instance()->CurrentThread() == this);
+ // Some tests post destroy messages to this thread. To avoid memory
+ // leaks, we have to process those messages. In particular
+ // P2PTransportChannelPingTest, relying on the message posted in
+ // cricket::Connection::Destroy.
Taylor Brandstetter 2017/05/03 22:17:27 I'd consider this a bug with cricket::Connection::
nisse-webrtc 2017/05/05 07:58:35 Done.
+ ProcessMessages(0);
+ rtc::ThreadManager::Instance()->SetCurrentThread(old_thread_);
+ if (old_thread_) {
+ MessageQueueManager::Add(old_thread_);
+ }
+}
+
} // namespace rtc
« no previous file with comments | « webrtc/base/thread.h ('k') | webrtc/base/virtualsocket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698