| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/webrtc/stun_field_trial.h" | 5 #include "content/renderer/media/webrtc/stun_field_trial.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 enum NatType { | 34 enum NatType { |
| 35 NAT_TYPE_NONE, | 35 NAT_TYPE_NONE, |
| 36 NAT_TYPE_UNKNOWN, | 36 NAT_TYPE_UNKNOWN, |
| 37 NAT_TYPE_SYMMETRIC, | 37 NAT_TYPE_SYMMETRIC, |
| 38 NAT_TYPE_NON_SYMMETRIC, | 38 NAT_TYPE_NON_SYMMETRIC, |
| 39 NAT_TYPE_MAX | 39 NAT_TYPE_MAX |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // This needs to match "NatType" in histograms.xml. | 42 // This needs to match "NatType" in histograms.xml. |
| 43 const char* NatTypeNames[] = {"NoNAT", "UnknownNAT", "SymNAT", "NonSymNAT"}; | 43 const char* NatTypeNames[] = {"NoNAT", "UnknownNAT", "SymNAT", "NonSymNAT"}; |
| 44 COMPILE_ASSERT(arraysize(NatTypeNames) == NAT_TYPE_MAX, NamesArraySizeNotMatch); | 44 static_assert(arraysize(NatTypeNames) == NAT_TYPE_MAX, |
| 45 "NatType enums must match names"); |
| 45 | 46 |
| 46 NatType GetNatType(stunprober::NatType nat_type) { | 47 NatType GetNatType(stunprober::NatType nat_type) { |
| 47 switch (nat_type) { | 48 switch (nat_type) { |
| 48 case stunprober::NATTYPE_NONE: | 49 case stunprober::NATTYPE_NONE: |
| 49 return NAT_TYPE_NONE; | 50 return NAT_TYPE_NONE; |
| 50 case stunprober::NATTYPE_UNKNOWN: | 51 case stunprober::NATTYPE_UNKNOWN: |
| 51 return NAT_TYPE_UNKNOWN; | 52 return NAT_TYPE_UNKNOWN; |
| 52 case stunprober::NATTYPE_SYMMETRIC: | 53 case stunprober::NATTYPE_SYMMETRIC: |
| 53 return NAT_TYPE_SYMMETRIC; | 54 return NAT_TYPE_SYMMETRIC; |
| 54 case stunprober::NATTYPE_NON_SYMMETRIC: | 55 case stunprober::NATTYPE_NON_SYMMETRIC: |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 void StunProberTrial::OnTimer() { | 303 void StunProberTrial::OnTimer() { |
| 303 DCHECK(thread_checker_.CalledOnValidThread()); | 304 DCHECK(thread_checker_.CalledOnValidThread()); |
| 304 probers_[started_probers_]->Start(this); | 305 probers_[started_probers_]->Start(this); |
| 305 started_probers_++; | 306 started_probers_++; |
| 306 | 307 |
| 307 if (started_probers_ == total_probers_) | 308 if (started_probers_ == total_probers_) |
| 308 timer_.Stop(); | 309 timer_.Stop(); |
| 309 } | 310 } |
| 310 | 311 |
| 311 } // namespace content | 312 } // namespace content |
| OLD | NEW |