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

Unified Diff: webrtc/base/network.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
Index: webrtc/base/network.h
diff --git a/webrtc/base/network.h b/webrtc/base/network.h
index 05943fb9125ea23f9cc24cf7f30f45a7841175ee..a8cfb6919423fe3c00748229364ba550e094ece5 100644
--- a/webrtc/base/network.h
+++ b/webrtc/base/network.h
@@ -63,6 +63,11 @@ class DefaultLocalAddressProvider {
// Generic network manager interface. It provides list of local
// networks.
+//
+// This class can be constructed on any thread, but every other method
+// (including the destructor) should be called on a different thread.
pthatcher1 2016/06/23 22:01:59 This makes it sound like it must be constructed an
Taylor Brandstetter 2016/06/23 22:59:07 Good catch. Just a situation where my brain was wo
+// This allows constructing a NetworkManager subclass on one thread and
+// passing it into an object that uses it on a different thread.
class NetworkManager : public DefaultLocalAddressProvider {
public:
typedef std::vector<Network*> NetworkList;
@@ -85,6 +90,10 @@ class NetworkManager : public DefaultLocalAddressProvider {
// Indicates a failure when getting list of network interfaces.
sigslot::signal0<> SignalError;
+ // This should be called on the NetworkManager's thread before the
+ // NetworkManager is used. Subclasses may override this if necessary.
+ virtual void Initialize() {}
+
// Start/Stop monitoring of network interfaces
// list. SignalNetworksChanged or SignalError is emitted immediately
// after StartUpdating() is called. After that SignalNetworksChanged

Powered by Google App Engine
This is Rietveld 408576698