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

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

Issue 2120733002: Make the state transition for a PortAllocatorSession in each derived class (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@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
« no previous file with comments | « webrtc/p2p/base/fakeportallocator.h ('k') | webrtc/p2p/client/basicportallocator.h » ('j') | 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 dc1961db73f2ab41c8f887a2b90ebbd3174bb20a..152474d4f4476b5fc3060bb092e9f83cebd9aac3 100644
--- a/webrtc/p2p/base/portallocator.h
+++ b/webrtc/p2p/base/portallocator.h
@@ -88,14 +88,6 @@ enum {
CF_ALL = 0x7,
};
-enum class SessionState {
- GATHERING, // Actively allocating ports and gathering candidates.
- CLEARED, // Current allocation process has been stopped but may start
- // new ones.
- STOPPED // This session has completely stopped, no new allocation
- // process will be started.
-};
-
// TODO(deadbeef): Rename to TurnCredentials (and username to ufrag).
struct RelayCredentials {
RelayCredentials() {}
@@ -167,18 +159,19 @@ class PortAllocatorSession : public sigslot::has_slots<> {
virtual void SetCandidateFilter(uint32_t filter) = 0;
// Starts gathering STUN and Relay configurations.
- virtual void StartGettingPorts() { state_ = SessionState::GATHERING; }
+ virtual void StartGettingPorts() = 0;
// Completely stops the gathering process and will not start new ones.
- virtual void StopGettingPorts() { state_ = SessionState::STOPPED; }
- // Only stops the existing gathering process but may start new ones if needed.
- virtual void ClearGettingPorts() { state_ = SessionState::CLEARED; }
+ virtual void StopGettingPorts() = 0;
// Whether the session is actively getting ports.
- bool IsGettingPorts() { return state_ == SessionState::GATHERING; }
+ virtual bool IsGettingPorts() = 0;
+ // ClearGettingPorts and IsCleared are used by continual gathering.
+ // Only stops the existing gathering process but may start new ones if needed.
+ virtual void ClearGettingPorts() = 0;
// Whether it is in the state where the existing gathering process is stopped,
// but new ones may be started (basically after calling ClearGettingPorts).
- bool IsCleared() { return state_ == SessionState::CLEARED; }
+ virtual bool IsCleared() const { return false; }
// Whether the session has completely stopped.
- bool IsStopped() { return state_ == SessionState::STOPPED; }
+ virtual bool IsStopped() const { return false; }
// Re-gathers candidates on networks that do not have any connections. More
// precisely, a network interface may have more than one IP addresses (e.g.,
// IPv4 and IPv6 addresses). Each address subnet will be used to create a
@@ -252,7 +245,6 @@ class PortAllocatorSession : public sigslot::has_slots<> {
int component_;
std::string ice_ufrag_;
std::string ice_pwd_;
- SessionState state_ = SessionState::CLEARED;
// SetIceParameters is an implementation detail which only PortAllocator
// should be able to call.
« no previous file with comments | « webrtc/p2p/base/fakeportallocator.h ('k') | webrtc/p2p/client/basicportallocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698