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

Unified Diff: webrtc/p2p/client/basicportallocator.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/portallocator.h ('k') | webrtc/p2p/client/basicportallocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/client/basicportallocator.h
diff --git a/webrtc/p2p/client/basicportallocator.h b/webrtc/p2p/client/basicportallocator.h
index f133bdfc7ecfa50c1938bb55ea85be3f07923631..d9cfc4d81a74ffdf1217f8685371258b771b87b7 100644
--- a/webrtc/p2p/client/basicportallocator.h
+++ b/webrtc/p2p/client/basicportallocator.h
@@ -74,6 +74,14 @@ class BasicPortAllocator : public PortAllocator {
struct PortConfiguration;
class AllocationSequence;
+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.
+};
+
class BasicPortAllocatorSession : public PortAllocatorSession,
public rtc::MessageHandler {
public:
@@ -92,6 +100,9 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
void StartGettingPorts() override;
void StopGettingPorts() override;
void ClearGettingPorts() override;
+ bool IsGettingPorts() override { return state_ == SessionState::GATHERING; }
+ bool IsCleared() const override { return state_ == SessionState::CLEARED; }
+ bool IsStopped() const override { return state_ == SessionState::STOPPED; }
// These will all be cricket::Ports.
std::vector<PortInterface*> ReadyPorts() const override;
std::vector<Candidate> ReadyCandidates() const override;
@@ -212,6 +223,7 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
uint32_t candidate_filter_ = CF_ALL;
// Whether to prune low-priority ports, taken from the port allocator.
bool prune_turn_ports_;
+ SessionState state_ = SessionState::CLEARED;
friend class AllocationSequence;
};
« no previous file with comments | « webrtc/p2p/base/portallocator.h ('k') | webrtc/p2p/client/basicportallocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698