Index: content/renderer/media/webrtc/stun_field_trial.h |
diff --git a/content/renderer/media/webrtc/stun_field_trial.h b/content/renderer/media/webrtc/stun_field_trial.h |
index 4095bede6812c01ab81f8b934d2f642a2731e52f..34fb084130aa4cce64026603ed194b7e0c936683 100644 |
--- a/content/renderer/media/webrtc/stun_field_trial.h |
+++ b/content/renderer/media/webrtc/stun_field_trial.h |
@@ -6,22 +6,45 @@ |
#define CONTENT_RENDERER_MEDIA_WEBRTC_STUN_FIELD_TRIAL_H_ |
#include <string> |
+#include <vector> |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
#include "content/common/content_export.h" |
#include "third_party/webrtc/base/network.h" |
+#include "third_party/webrtc/p2p/stunprober/stunprober.h" |
namespace rtc { |
class PacketSocketFactory; |
class SocketAddress; |
} // namespace rtc |
-namespace stunprober { |
-class StunProber; |
-} // namespace stunprober |
- |
namespace content { |
+// Helper class to link the StunProbers together such that they could be started |
+// in the right timing. |
+class StunProberWithWeakPtr { |
+ public: |
+ StunProberWithWeakPtr(stunprober::StunProber* prober); |
+ virtual ~StunProberWithWeakPtr(); |
+ void set_next_prober(StunProberWithWeakPtr* prober); |
+ void Start(stunprober::AsyncCallback callback); |
+ base::WeakPtr<StunProberWithWeakPtr> GetWeakPtr() { |
+ return weak_factory_.GetWeakPtr(); |
+ } |
+ bool GetStats(stunprober::StunProber::Stats* stats) { |
+ return prober_->GetStats(stats); |
+ } |
+ StunProberWithWeakPtr* GetNextProber() { return next_prober_; } |
+ |
+ private: |
+ scoped_ptr<stunprober::StunProber> prober_; |
+ StunProberWithWeakPtr* next_prober_ = nullptr; |
pthatcher2
2015/10/22 05:27:52
So a StunProberWithWeakPtr is really a linked list
|
+ base::WeakPtrFactory<StunProberWithWeakPtr> weak_factory_; |
+}; |
+ |
+typedef std::vector<StunProberWithWeakPtr*> ListOfStunProbers; |
pthatcher2
2015/10/22 05:27:52
Doesn't the style guide discourage typedefs like t
|
+ |
// Wait for 30 seconds to avoid high CPU usage during browser start-up which |
// might affect the accuracy of the trial. The trial wakes up the browser every |
// 1 ms for no more than 3 seconds to see if time has passed for sending next |
@@ -31,10 +54,10 @@ static const int kExperimentStartDelayMs = 30000; |
// This will use |factory| to create sockets, send stun binding requests with |
// various intervals as determined by |params|, observed the success rate and |
// latency of the stun responses and report through UMA. |
-scoped_ptr<stunprober::StunProber> StartStunProbeTrial( |
- const rtc::NetworkManager::NetworkList& networks, |
- const std::string& params, |
- rtc::PacketSocketFactory* factory); |
+void StartStunProbeTrial(const rtc::NetworkManager::NetworkList& networks, |
+ const std::string& params, |
+ rtc::PacketSocketFactory* factory, |
+ ListOfStunProbers* probers); |
// Parsing function to decode the '/' separated parameter string |params|. |
CONTENT_EXPORT bool ParseStunProbeParameters( |
@@ -42,6 +65,7 @@ CONTENT_EXPORT bool ParseStunProbeParameters( |
int* requests_per_ip, |
int* interval_ms, |
int* shared_socket_mode, |
+ int* rounds, |
std::vector<rtc::SocketAddress>* servers); |
} // namespace content |