 Chromium Code Reviews
 Chromium Code Reviews Issue 2025573002:
  Use continual gathering to restore backup connections  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master
    
  
    Issue 2025573002:
  Use continual gathering to restore backup connections  (Closed) 
  Base URL: https://chromium.googlesource.com/external/webrtc@master| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 
| 3 * | 3 * | 
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license | 
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source | 
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found | 
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may | 
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. | 
| 9 */ | 9 */ | 
| 10 | 10 | 
| 11 #ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 11 #ifndef WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 
| 12 #define WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 12 #define WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 
| 13 | 13 | 
| 14 #include <deque> | 14 #include <deque> | 
| 15 #include <memory> | 15 #include <memory> | 
| 16 #include <string> | 16 #include <string> | 
| 17 #include <vector> | 17 #include <vector> | 
| 18 | 18 | 
| 19 #include "webrtc/p2p/base/port.h" | 19 #include "webrtc/p2p/base/port.h" | 
| 20 #include "webrtc/p2p/base/portinterface.h" | 20 #include "webrtc/p2p/base/portinterface.h" | 
| 21 #include "webrtc/base/helpers.h" | 21 #include "webrtc/base/helpers.h" | 
| 22 #include "webrtc/base/proxyinfo.h" | 22 #include "webrtc/base/proxyinfo.h" | 
| 23 #include "webrtc/base/sigslot.h" | 23 #include "webrtc/base/sigslot.h" | 
| 24 #include "webrtc/base/thread.h" | 24 #include "webrtc/base/thread.h" | 
| 25 | 25 | 
| 26 namespace rtc { | |
| 27 class Network; | |
| 28 class NetworkManager; | |
| 29 } // namespace rtc | |
| 30 | |
| 26 namespace cricket { | 31 namespace cricket { | 
| 27 | 32 | 
| 28 // PortAllocator is responsible for allocating Port types for a given | 33 // PortAllocator is responsible for allocating Port types for a given | 
| 29 // P2PSocket. It also handles port freeing. | 34 // P2PSocket. It also handles port freeing. | 
| 30 // | 35 // | 
| 31 // Clients can override this class to control port allocation, including | 36 // Clients can override this class to control port allocation, including | 
| 32 // what kinds of ports are allocated. | 37 // what kinds of ports are allocated. | 
| 33 | 38 | 
| 34 enum { | 39 enum { | 
| 35 // Disable local UDP ports. This doesn't impact how we connect to relay | 40 // Disable local UDP ports. This doesn't impact how we connect to relay | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 // Default filter should be CF_ALL. | 163 // Default filter should be CF_ALL. | 
| 159 virtual void SetCandidateFilter(uint32_t filter) = 0; | 164 virtual void SetCandidateFilter(uint32_t filter) = 0; | 
| 160 | 165 | 
| 161 // Starts gathering STUN and Relay configurations. | 166 // Starts gathering STUN and Relay configurations. | 
| 162 virtual void StartGettingPorts() = 0; | 167 virtual void StartGettingPorts() = 0; | 
| 163 virtual void StopGettingPorts() = 0; | 168 virtual void StopGettingPorts() = 0; | 
| 164 // Only stop the existing gathering process but may start new ones if needed. | 169 // Only stop the existing gathering process but may start new ones if needed. | 
| 165 virtual void ClearGettingPorts() = 0; | 170 virtual void ClearGettingPorts() = 0; | 
| 166 // Whether the process of getting ports has been stopped. | 171 // Whether the process of getting ports has been stopped. | 
| 167 virtual bool IsGettingPorts() = 0; | 172 virtual bool IsGettingPorts() = 0; | 
| 173 // Get ports and re-gather candidates on the given networks. | |
| 174 // If |networks| is nullptr, get ports and candidates on all networks. | |
| 175 virtual void GetPortsOnNetworks(const std::vector<rtc::Network*>* networks) {} | |
| 
pthatcher1
2016/06/07 18:54:34
I think this would be more clear with two methods:
 | |
| 168 | 176 | 
| 169 // Another way of getting the information provided by the signals below. | 177 // Another way of getting the information provided by the signals below. | 
| 170 // | 178 // | 
| 171 // Ports and candidates are not guaranteed to be in the same order as the | 179 // Ports and candidates are not guaranteed to be in the same order as the | 
| 172 // signals were emitted in. | 180 // signals were emitted in. | 
| 173 virtual std::vector<PortInterface*> ReadyPorts() const = 0; | 181 virtual std::vector<PortInterface*> ReadyPorts() const = 0; | 
| 174 virtual std::vector<Candidate> ReadyCandidates() const = 0; | 182 virtual std::vector<Candidate> ReadyCandidates() const = 0; | 
| 183 // Returns the sanitized candidates on |port|. | |
| 184 virtual std::vector<Candidate> ReadyCandidates(PortInterface* port) const = 0; | |
| 175 virtual bool CandidatesAllocationDone() const = 0; | 185 virtual bool CandidatesAllocationDone() const = 0; | 
| 176 | 186 | 
| 177 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; | 187 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; | 
| 178 sigslot::signal2<PortAllocatorSession*, | 188 sigslot::signal2<PortAllocatorSession*, | 
| 179 const std::vector<Candidate>&> SignalCandidatesReady; | 189 const std::vector<Candidate>&> SignalCandidatesReady; | 
| 180 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; | 190 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; | 
| 181 | 191 | 
| 182 virtual uint32_t generation() { return generation_; } | 192 virtual uint32_t generation() { return generation_; } | 
| 183 virtual void set_generation(uint32_t generation) { generation_ = generation; } | 193 virtual void set_generation(uint32_t generation) { generation_ = generation; } | 
| 184 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; | 194 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 | 266 | 
| 257 int candidate_pool_size() const { return target_pooled_session_count_; } | 267 int candidate_pool_size() const { return target_pooled_session_count_; } | 
| 258 | 268 | 
| 259 // Sets the network types to ignore. | 269 // Sets the network types to ignore. | 
| 260 // Values are defined by the AdapterType enum. | 270 // Values are defined by the AdapterType enum. | 
| 261 // For instance, calling this with | 271 // For instance, calling this with | 
| 262 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and | 272 // ADAPTER_TYPE_ETHERNET | ADAPTER_TYPE_LOOPBACK will ignore Ethernet and | 
| 263 // loopback interfaces. | 273 // loopback interfaces. | 
| 264 virtual void SetNetworkIgnoreMask(int network_ignore_mask) = 0; | 274 virtual void SetNetworkIgnoreMask(int network_ignore_mask) = 0; | 
| 265 | 275 | 
| 276 virtual rtc::NetworkManager* network_manager() const = 0; | |
| 
pthatcher1
2016/06/07 18:54:34
***
 | |
| 277 | |
| 266 std::unique_ptr<PortAllocatorSession> CreateSession( | 278 std::unique_ptr<PortAllocatorSession> CreateSession( | 
| 267 const std::string& sid, | 279 const std::string& sid, | 
| 268 const std::string& content_name, | 280 const std::string& content_name, | 
| 269 int component, | 281 int component, | 
| 270 const std::string& ice_ufrag, | 282 const std::string& ice_ufrag, | 
| 271 const std::string& ice_pwd); | 283 const std::string& ice_pwd); | 
| 272 | 284 | 
| 273 // Get an available pooled session and set the transport information on it. | 285 // Get an available pooled session and set the transport information on it. | 
| 274 // | 286 // | 
| 275 // Caller takes ownership of the returned session. | 287 // Caller takes ownership of the returned session. | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 int target_pooled_session_count_ = 0; | 360 int target_pooled_session_count_ = 0; | 
| 349 // This variable represents the total number of pooled sessions | 361 // This variable represents the total number of pooled sessions | 
| 350 // both owned by this class and taken by TakePooledSession. | 362 // both owned by this class and taken by TakePooledSession. | 
| 351 int allocated_pooled_session_count_ = 0; | 363 int allocated_pooled_session_count_ = 0; | 
| 352 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 364 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 
| 353 }; | 365 }; | 
| 354 | 366 | 
| 355 } // namespace cricket | 367 } // namespace cricket | 
| 356 | 368 | 
| 357 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 369 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 
| OLD | NEW |