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

Side by Side Diff: webrtc/p2p/base/portallocator.h

Issue 2097653002: Add virtual Initialize methods to PortAllocator and NetworkManager. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing typo in test. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/fakeportallocator.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 std::string content_name_; 214 std::string content_name_;
215 int component_; 215 int component_;
216 std::string ice_ufrag_; 216 std::string ice_ufrag_;
217 std::string ice_pwd_; 217 std::string ice_pwd_;
218 218
219 // SetIceParameters is an implementation detail which only PortAllocator 219 // SetIceParameters is an implementation detail which only PortAllocator
220 // should be able to call. 220 // should be able to call.
221 friend class PortAllocator; 221 friend class PortAllocator;
222 }; 222 };
223 223
224 // Note that this class should only be used on one thread. 224 // Every method of PortAllocator (including the destructor) must be called on
225 // This includes calling the destructor. 225 // the same thread, except for the constructor which may be called on any
226 // thread.
227 //
228 // This allows constructing a PortAllocator subclass on one thread and
229 // passing it into an object that uses it on a different thread.
226 class PortAllocator : public sigslot::has_slots<> { 230 class PortAllocator : public sigslot::has_slots<> {
227 public: 231 public:
228 PortAllocator() : 232 PortAllocator() :
229 flags_(kDefaultPortAllocatorFlags), 233 flags_(kDefaultPortAllocatorFlags),
230 min_port_(0), 234 min_port_(0),
231 max_port_(0), 235 max_port_(0),
232 step_delay_(kDefaultStepDelay), 236 step_delay_(kDefaultStepDelay),
233 allow_tcp_listen_(true), 237 allow_tcp_listen_(true),
234 candidate_filter_(CF_ALL) { 238 candidate_filter_(CF_ALL) {
235 // This will allow us to have old behavior on non webrtc clients.
236 } 239 }
237 virtual ~PortAllocator() {} 240 virtual ~PortAllocator() {}
238 241
242 // This should be called on the PortAllocator's thread before the
243 // PortAllocator is used. Subclasses may override this if necessary.
244 virtual void Initialize() {}
245
239 // Set STUN and TURN servers to be used in future sessions, and set 246 // Set STUN and TURN servers to be used in future sessions, and set
240 // candidate pool size, as described in JSEP. 247 // candidate pool size, as described in JSEP.
241 // 248 //
242 // If the servers are changing and the candidate pool size is nonzero, 249 // If the servers are changing and the candidate pool size is nonzero,
243 // existing pooled sessions will be destroyed and new ones created. 250 // existing pooled sessions will be destroyed and new ones created.
244 // 251 //
245 // If the servers are not changing but the candidate pool size is, 252 // If the servers are not changing but the candidate pool size is,
246 // pooled sessions will be either created or destroyed as necessary. 253 // pooled sessions will be either created or destroyed as necessary.
247 void SetConfiguration(const ServerAddresses& stun_servers, 254 void SetConfiguration(const ServerAddresses& stun_servers,
248 const std::vector<RelayServerConfig>& turn_servers, 255 const std::vector<RelayServerConfig>& turn_servers,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 int target_pooled_session_count_ = 0; 355 int target_pooled_session_count_ = 0;
349 // This variable represents the total number of pooled sessions 356 // This variable represents the total number of pooled sessions
350 // both owned by this class and taken by TakePooledSession. 357 // both owned by this class and taken by TakePooledSession.
351 int allocated_pooled_session_count_ = 0; 358 int allocated_pooled_session_count_ = 0;
352 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_; 359 std::deque<std::unique_ptr<PortAllocatorSession>> pooled_sessions_;
353 }; 360 };
354 361
355 } // namespace cricket 362 } // namespace cricket
356 363
357 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_ 364 #endif // WEBRTC_P2P_BASE_PORTALLOCATOR_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/fakeportallocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698