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..3e7591f6d40f56e7cd15b3e8906b1c58152549a7 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,16 @@ enum { |
| PORTALLOCATOR_DISABLE_COSTLY_NETWORKS = 0x2000, |
| }; |
| +// Defines various reasons that have caused ICE regathering. |
| +enum class IceRegatheringReason { |
| + ICE_RESTART_WHEN_CONNECTED, |
| + ICE_RESTART_WHEN_CONNECTING, |
| + ICE_RESTART_WHEN_DISCONNECTED, |
| + CONTINUAL_GATHERING_BY_NETWORK_CHANGE, |
| + CONTINUAL_GATHERING_BY_NETWORK_FAILURE, |
| + MAX_VALUE |
| +}; |
| + |
| const uint32_t kDefaultPortAllocatorFlags = 0; |
| const uint32_t kDefaultStepDelay = 1000; // 1 sec step delay. |
| @@ -216,6 +230,9 @@ class PortAllocatorSession : public sigslot::has_slots<> { |
| SignalCandidatesRemoved; |
| sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; |
| + sigslot::signal2<PortAllocatorSession*, IceRegatheringReason> |
| + SignalIceRegatheringReason; |
| + |
| virtual uint32_t generation() { return generation_; } |
| virtual void set_generation(uint32_t generation) { generation_ = generation; } |
| sigslot::signal1<PortAllocatorSession*> SignalDestroyed; |
| @@ -370,6 +387,10 @@ class PortAllocator : public sigslot::has_slots<> { |
| const std::string& origin() const { return origin_; } |
| void set_origin(const std::string& origin) { origin_ = origin; } |
| + void set_metrics_observer(webrtc::MetricsObserverInterface* observer) { |
| + metrics_observer_ = observer; |
| + } |
|
Taylor Brandstetter
2016/10/03 20:33:35
It seems confusing that the metrics observer is se
honghaiz3
2016/10/04 01:03:55
The first part, really just follows a few other me
Taylor Brandstetter
2016/10/04 02:42:32
The enum definition doesn't matter too much. What
honghaiz3
2016/10/04 04:06:42
This is what I was doing in the second patch.
Taylor Brandstetter
2016/10/04 17:44:15
I'd still prefer #1, because I don't think it shou
honghaiz3
2016/10/05 05:01:53
Done.
|
| + |
| protected: |
| virtual PortAllocatorSession* CreateSessionInternal( |
| const std::string& content_name, |
| @@ -377,6 +398,10 @@ class PortAllocator : public sigslot::has_slots<> { |
| const std::string& ice_ufrag, |
| const std::string& ice_pwd) = 0; |
| + webrtc::MetricsObserverInterface* metrics_observer() { |
| + return metrics_observer_; |
| + } |
| + |
| uint32_t flags_; |
| std::string agent_; |
| rtc::ProxyInfo proxy_; |
| @@ -397,6 +422,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 |