Chromium Code Reviews| 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 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 // TODO(honghaiz): Implement this in BasicPortAllocator. | 182 // TODO(honghaiz): Implement this in BasicPortAllocator. |
| 183 virtual void RegatherOnAllNetworks() {} | 183 virtual void RegatherOnAllNetworks() {} |
| 184 | 184 |
| 185 // Another way of getting the information provided by the signals below. | 185 // Another way of getting the information provided by the signals below. |
| 186 // | 186 // |
| 187 // Ports and candidates are not guaranteed to be in the same order as the | 187 // Ports and candidates are not guaranteed to be in the same order as the |
| 188 // signals were emitted in. | 188 // signals were emitted in. |
| 189 virtual std::vector<PortInterface*> ReadyPorts() const = 0; | 189 virtual std::vector<PortInterface*> ReadyPorts() const = 0; |
| 190 virtual std::vector<Candidate> ReadyCandidates() const = 0; | 190 virtual std::vector<Candidate> ReadyCandidates() const = 0; |
| 191 virtual bool CandidatesAllocationDone() const = 0; | 191 virtual bool CandidatesAllocationDone() const = 0; |
| 192 // Marks all ports in the current session as "pruned" so that they may be | |
| 193 // destroyed if there is no connection on them. | |
|
pthatcher1
2016/07/28 19:35:05
if there is no connection on them => if no connect
honghaiz3
2016/07/28 22:51:44
Done.
| |
| 194 virtual void PruneAllPorts() {} | |
| 192 | 195 |
| 193 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; | 196 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortReady; |
| 194 // Ports should be signaled to be removed when the networks of the ports | 197 // Fires this signal when the network of the ports failed (either because the |
| 195 // failed (either because the interface is down, or because there is no | 198 // interface is down, or because there is no connection on the interface), |
| 196 // connection on the interface). | 199 // or when TURN ports are pruned because a higher-priority TURN port becomes |
| 200 // ready(pairable). | |
| 197 sigslot::signal2<PortAllocatorSession*, const std::vector<PortInterface*>&> | 201 sigslot::signal2<PortAllocatorSession*, const std::vector<PortInterface*>&> |
| 198 SignalPortsRemoved; | 202 SignalPortsPruned; |
| 199 sigslot::signal2<PortAllocatorSession*, | 203 sigslot::signal2<PortAllocatorSession*, |
| 200 const std::vector<Candidate>&> SignalCandidatesReady; | 204 const std::vector<Candidate>&> SignalCandidatesReady; |
| 201 // Candidates should be signaled to be removed when the port that generated | 205 // Candidates should be signaled to be removed when the port that generated |
| 202 // the candidates is removed. | 206 // the candidates is removed. |
| 203 sigslot::signal2<PortAllocatorSession*, const std::vector<Candidate>&> | 207 sigslot::signal2<PortAllocatorSession*, const std::vector<Candidate>&> |
| 204 SignalCandidatesRemoved; | 208 SignalCandidatesRemoved; |
| 205 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; | 209 sigslot::signal1<PortAllocatorSession*> SignalCandidatesAllocationDone; |
| 206 // A TURN port is pruned if a higher-priority TURN port becomes ready | |
| 207 // (pairable). When it is pruned, it will not be used for creating | |
| 208 // connections and its candidates will not be sent to the remote side | |
| 209 // if they have not been sent. | |
| 210 sigslot::signal2<PortAllocatorSession*, PortInterface*> SignalPortPruned; | |
| 211 | 210 |
| 212 virtual uint32_t generation() { return generation_; } | 211 virtual uint32_t generation() { return generation_; } |
| 213 virtual void set_generation(uint32_t generation) { generation_ = generation; } | 212 virtual void set_generation(uint32_t generation) { generation_ = generation; } |
| 214 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; | 213 sigslot::signal1<PortAllocatorSession*> SignalDestroyed; |
| 215 | 214 |
| 216 protected: | 215 protected: |
| 217 // This method is called when a pooled session (which doesn't have these | 216 // This method is called when a pooled session (which doesn't have these |
| 218 // properties initially) is returned by PortAllocator::TakePooledSession, | 217 // properties initially) is returned by PortAllocator::TakePooledSession, |
| 219 // and the content name, component, and ICE ufrag/pwd are updated. | 218 // and the content name, component, and ICE ufrag/pwd are updated. |
| 220 // | 219 // |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 // This variable represents the total number of pooled sessions | 388 // This variable represents the total number of pooled sessions |
| 390 // both owned by this class and taken by TakePooledSession. | 389 // both owned by this class and taken by TakePooledSession. |
| 391 int allocated_pooled_session_count_ = 0; | 390 int allocated_pooled_session_count_ = 0; |
| 392 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; | 391 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; |
| 393 bool prune_turn_ports_ = false; | 392 bool prune_turn_ports_ = false; |
| 394 }; | 393 }; |
| 395 | 394 |
| 396 } // namespace cricket | 395 } // namespace cricket |
| 397 | 396 |
| 398 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ | 397 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ |
| OLD | NEW |