Index: webrtc/base/thread.h |
diff --git a/webrtc/base/thread.h b/webrtc/base/thread.h |
index e9bb3249ea809f9b963d58a3a65d932a3e2d3be7..291361cf49612209ffd1a9d2ff8b665ed88f4073 100644 |
--- a/webrtc/base/thread.h |
+++ b/webrtc/base/thread.h |
@@ -311,21 +311,20 @@ class AutoThread : public Thread { |
RTC_DISALLOW_COPY_AND_ASSIGN(AutoThread); |
}; |
-// Provides an easy way to install/uninstall a socketserver on a thread. |
-class SocketServerScope { |
+// AutoSocketServerThread automatically installs itself at |
+// construction uninstalls at destruction. If a Thread object is |
Taylor Brandstetter
2017/04/28 02:59:34
missing "and" between "construction and uninstalls
nisse-webrtc
2017/04/28 09:46:52
Done.
|
+// already associated with the current OS thread, it is temporarily |
+// disassociated and restored by the destructor. |
+ |
+class AutoSocketServerThread : public Thread { |
public: |
- explicit SocketServerScope(SocketServer* ss) { |
- old_ss_ = Thread::Current()->socketserver(); |
- Thread::Current()->set_socketserver(ss); |
- } |
- ~SocketServerScope() { |
- Thread::Current()->set_socketserver(old_ss_); |
- } |
+ explicit AutoSocketServerThread(SocketServer* ss); |
+ ~AutoSocketServerThread() override; |
private: |
- SocketServer* old_ss_; |
+ rtc::Thread* old_thread_; |
- RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SocketServerScope); |
+ RTC_DISALLOW_COPY_AND_ASSIGN(AutoSocketServerThread); |
}; |
} // namespace rtc |