Adds clearer function to create rtc::Thread without Physical SocketServer
Moves logic of default SocketServer from MessageQueue to SocketServer
Review-Url: https://codereview.webrtc.org/1891293002
Cr-Commit-Position: refs/heads/master@{#12541}
diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h
index d323283..30746f6 100644
--- a/webrtc/base/messagequeue.h
+++ b/webrtc/base/messagequeue.h
@@ -175,8 +175,8 @@
// init_queue and call DoInit() from their constructor to prevent races
// with the MessageQueueManager using the object while the vtable is still
// being created.
- explicit MessageQueue(SocketServer* ss = NULL,
- bool init_queue = true);
+ MessageQueue(SocketServer* ss, bool init_queue);
+ MessageQueue(std::unique_ptr<SocketServer> ss, bool init_queue);
// NOTE: SUBCLASSES OF MessageQueue THAT OVERRIDE Clear MUST CALL
// DoDestroy() IN THEIR DESTRUCTORS! This is required to avoid a data race
@@ -276,13 +276,13 @@
bool fDestroyed_;
private:
- // The SocketServer is not owned by MessageQueue.
+ // The SocketServer might not be owned by MessageQueue.
SocketServer* ss_ GUARDED_BY(ss_lock_);
- // If a server isn't supplied in the constructor, use this one.
- std::unique_ptr<SocketServer> default_ss_;
+ // Used if SocketServer ownership lies with |this|.
+ std::unique_ptr<SocketServer> own_ss_;
SharedExclusiveLock ss_lock_;
- RTC_DISALLOW_COPY_AND_ASSIGN(MessageQueue);
+ RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MessageQueue);
};
} // namespace rtc