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

Unified Diff: webrtc/p2p/base/portallocator.h

Issue 2097653002: Add virtual Initialize methods to PortAllocator and NetworkManager. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 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
« webrtc/base/network.h ('K') | « webrtc/p2p/base/fakeportallocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/portallocator.h
diff --git a/webrtc/p2p/base/portallocator.h b/webrtc/p2p/base/portallocator.h
index 7d2a59f278ccb307ce0266ef89f65234eb291768..d03d29745c2d56f65dc8545c724aa93cca35db0d 100644
--- a/webrtc/p2p/base/portallocator.h
+++ b/webrtc/p2p/base/portallocator.h
@@ -221,8 +221,10 @@ class PortAllocatorSession : public sigslot::has_slots<> {
friend class PortAllocator;
};
-// Note that this class should only be used on one thread.
-// This includes calling the destructor.
+// This class can be constructed on any thread, but every other method
+// (including the destructor) should be called on a different thread.
skvlad 2016/06/23 22:15:55 Do we have a way to verify that the "other thread"
Taylor Brandstetter 2016/06/23 22:59:07 Yeah, we can call "DetachFromThread" in the constr
+// This allows constructing a PortAllocator subclass on one thread and
+// passing it into an object that uses it on a different thread.
class PortAllocator : public sigslot::has_slots<> {
public:
PortAllocator() :
@@ -232,10 +234,13 @@ class PortAllocator : public sigslot::has_slots<> {
step_delay_(kDefaultStepDelay),
allow_tcp_listen_(true),
candidate_filter_(CF_ALL) {
- // This will allow us to have old behavior on non webrtc clients.
}
virtual ~PortAllocator() {}
+ // This should be called on the PortAllocator's thread before the
+ // PortAllocator is used. Subclasses may override this if necessary.
+ virtual void Initialize() {}
+
// Set STUN and TURN servers to be used in future sessions, and set
// candidate pool size, as described in JSEP.
//
« webrtc/base/network.h ('K') | « webrtc/p2p/base/fakeportallocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698