Chromium Code Reviews| Index: webrtc/p2p/base/portallocator.h |
| diff --git a/webrtc/p2p/base/portallocator.h b/webrtc/p2p/base/portallocator.h |
| index 8befbadcc73981375d22ba23b321c417fbb2cd21..e25c3e222c8a848533be08bc1e8d5606fbbf820d 100644 |
| --- a/webrtc/p2p/base/portallocator.h |
| +++ b/webrtc/p2p/base/portallocator.h |
| @@ -23,6 +23,10 @@ |
| #include "webrtc/base/sigslot.h" |
| #include "webrtc/base/thread.h" |
| +namespace webrtc { |
| +class MetricsObserverInterface; |
| +} |
| + |
| namespace cricket { |
| // PortAllocator is responsible for allocating Port types for a given |
| @@ -72,6 +76,9 @@ enum { |
| PORTALLOCATOR_DISABLE_COSTLY_NETWORKS = 0x2000, |
| }; |
| +// Defines various reasons that have caused ICE regathering. |
| +enum class IceRegatheringReason { NETWORK_CHANGE, NETWORK_FAILURE, MAX_VALUE }; |
| + |
| const uint32_t kDefaultPortAllocatorFlags = 0; |
| const uint32_t kDefaultStepDelay = 1000; // 1 sec step delay. |
| @@ -216,6 +223,9 @@ class PortAllocatorSession : public sigslot::has_slots<> { |
| SignalCandidatesRemoved; |
| sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; |
| + sigslot::signal2<PortAllocatorSession*, IceRegatheringReason> |
| + SignalIceRegathering; |
| + |
| virtual uint32_t generation() { return generation_; } |
| virtual void set_generation(uint32_t generation) { generation_ = generation; } |
| sigslot::signal1<PortAllocatorSession*> SignalDestroyed; |
| @@ -370,6 +380,10 @@ class PortAllocator : public sigslot::has_slots<> { |
| const std::string& origin() const { return origin_; } |
| void set_origin(const std::string& origin) { origin_ = origin; } |
| + void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) { |
| + metrics_observer_ = observer; |
| + } |
| + |
| protected: |
| virtual PortAllocatorSession* CreateSessionInternal( |
| const std::string& content_name, |
| @@ -377,6 +391,14 @@ class PortAllocator : public sigslot::has_slots<> { |
| const std::string& ice_ufrag, |
| const std::string& ice_pwd) = 0; |
| + webrtc::MetricsObserverInterface* metrics_observer() { |
| + return metrics_observer_; |
| + } |
| + |
| + std::deque<std::unique_ptr<PortAllocatorSession>>& pooled_sessions() { |
|
Taylor Brandstetter
2016/10/05 17:40:02
nit: Should this method be const and return a cons
honghaiz3
2016/10/05 18:04:37
Done.
|
| + return pooled_sessions_; |
| + } |
| + |
| uint32_t flags_; |
| std::string agent_; |
| rtc::ProxyInfo proxy_; |
| @@ -397,6 +419,8 @@ class PortAllocator : public sigslot::has_slots<> { |
| int allocated_pooled_session_count_ = 0; |
| std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; |
| bool prune_turn_ports_ = false; |
| + |
| + webrtc::MetricsObserverInterface* metrics_observer_ = nullptr; |
| }; |
| } // namespace cricket |