|
41 | 41 | #include "rtc_base/rate_tracker.h"
|
42 | 42 | #include "rtc_base/socket_address.h"
|
43 | 43 | #include "rtc_base/system/rtc_export.h"
|
44 |
| -#include "rtc_base/task_utils/pending_task_safety_flag.h" |
45 | 44 | #include "rtc_base/third_party/sigslot/sigslot.h"
|
46 | 45 | #include "rtc_base/thread.h"
|
47 | 46 | #include "rtc_base/weak_ptr.h"
|
@@ -172,6 +171,7 @@ typedef std::set<rtc::SocketAddress> ServerAddresses;
|
172 | 171 | // connections to similar mechanisms of the other client. Subclasses of this
|
173 | 172 | // one add support for specific mechanisms like local UDP ports.
|
174 | 173 | class Port : public PortInterface,
|
| 174 | + public rtc::MessageHandler, |
175 | 175 | public sigslot::has_slots<> {
|
176 | 176 | public:
|
177 | 177 | // INIT: The state when a port is just created.
|
@@ -220,6 +220,9 @@ class Port : public PortInterface,
|
220 | 220 | // Allows a port to be destroyed if no connection is using it.
|
221 | 221 | void Prune();
|
222 | 222 |
|
| 223 | + // Call to stop any currently pending operations from running. |
| 224 | + void CancelPendingTasks(); |
| 225 | + |
223 | 226 | // The thread on which this port performs its I/O.
|
224 | 227 | rtc::Thread* thread() { return thread_; }
|
225 | 228 |
|
@@ -325,6 +328,8 @@ class Port : public PortInterface,
|
325 | 328 | // Called if the port has no connections and is no longer useful.
|
326 | 329 | void Destroy();
|
327 | 330 |
|
| 331 | + void OnMessage(rtc::Message* pmsg) override; |
| 332 | + |
328 | 333 | // Debugging description of this port
|
329 | 334 | std::string ToString() const override;
|
330 | 335 | uint16_t min_port() { return min_port_; }
|
@@ -375,6 +380,8 @@ class Port : public PortInterface,
|
375 | 380 | const rtc::SocketAddress& base_address);
|
376 | 381 |
|
377 | 382 | protected:
|
| 383 | + enum { MSG_DESTROY_IF_DEAD = 0, MSG_FIRST_AVAILABLE }; |
| 384 | + |
378 | 385 | virtual void UpdateNetworkCost();
|
379 | 386 |
|
380 | 387 | void set_type(const std::string& type) { type_ = type; }
|
@@ -441,9 +448,8 @@ class Port : public PortInterface,
|
441 | 448 | void Construct();
|
442 | 449 | // Called when one of our connections deletes itself.
|
443 | 450 | void OnConnectionDestroyed(Connection* conn);
|
| 451 | + |
444 | 452 | void OnNetworkTypeChanged(const rtc::Network* network);
|
445 |
| - void ScheduleDelayedDestructionIfDead(); |
446 |
| - void DestroyIfDead(); |
447 | 453 |
|
448 | 454 | rtc::Thread* const thread_;
|
449 | 455 | rtc::PacketSocketFactory* const factory_;
|
@@ -493,7 +499,6 @@ class Port : public PortInterface,
|
493 | 499 |
|
494 | 500 | friend class Connection;
|
495 | 501 | webrtc::CallbackList<PortInterface*> port_destroyed_callback_list_;
|
496 |
| - webrtc::ScopedTaskSafety safety_; |
497 | 502 | };
|
498 | 503 |
|
499 | 504 | } // namespace cricket
|
|
0 commit comments