OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "net/nqe/network_quality_estimator_params.h" | 5 #include "net/nqe/network_quality_estimator_params.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 auto it = variation_params.find("HalfLifeSeconds"); | 90 auto it = variation_params.find("HalfLifeSeconds"); |
91 if (it != variation_params.end() && | 91 if (it != variation_params.end() && |
92 base::StringToInt(it->second, &variations_value) && | 92 base::StringToInt(it->second, &variations_value) && |
93 variations_value >= 1) { | 93 variations_value >= 1) { |
94 half_life_seconds = variations_value; | 94 half_life_seconds = variations_value; |
95 } | 95 } |
96 DCHECK_GT(half_life_seconds, 0); | 96 DCHECK_GT(half_life_seconds, 0); |
97 return pow(0.5, 1.0 / half_life_seconds); | 97 return pow(0.5, 1.0 / half_life_seconds); |
98 } | 98 } |
99 | 99 |
100 double GetWeightMultiplierPerDbm( | 100 double GetWeightMultiplierPerSignalStrengthLevel( |
101 const std::map<std::string, std::string>& variation_params) { | 101 const std::map<std::string, std::string>& variation_params) { |
102 // The default weight is set to 1.0, so by default, RSSI has no effect on the | 102 // The default weight is set to 1.0, so by default, RSSI has no effect on the |
103 // observation's weight. | 103 // observation's weight. |
104 return GetDoubleValueForVariationParamWithDefaultValue( | 104 return GetDoubleValueForVariationParamWithDefaultValue( |
105 variation_params, "rssi_weight_per_dbm", 1.0); | 105 variation_params, "rssi_weight_per_signal_strength_level", 1.0); |
106 } | 106 } |
107 | 107 |
108 const char* GetNameForConnectionType( | 108 const char* GetNameForConnectionType( |
109 net::NetworkChangeNotifier::ConnectionType connection_type) { | 109 net::NetworkChangeNotifier::ConnectionType connection_type) { |
110 switch (connection_type) { | 110 switch (connection_type) { |
111 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: | 111 case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: |
112 return "Unknown"; | 112 return "Unknown"; |
113 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: | 113 case net::NetworkChangeNotifier::CONNECTION_ETHERNET: |
114 return "Ethernet"; | 114 return "Ethernet"; |
115 case net::NetworkChangeNotifier::CONNECTION_WIFI: | 115 case net::NetworkChangeNotifier::CONNECTION_WIFI: |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 // Use 1000 milliseconds as the default value. | 384 // Use 1000 milliseconds as the default value. |
385 return base::TimeDelta::FromMilliseconds(GetValueForVariationParam( | 385 return base::TimeDelta::FromMilliseconds(GetValueForVariationParam( |
386 variation_params, "min_socket_watcher_notification_interval_msec", 1000)); | 386 variation_params, "min_socket_watcher_notification_interval_msec", 1000)); |
387 } | 387 } |
388 | 388 |
389 } // namespace internal | 389 } // namespace internal |
390 | 390 |
391 } // namespace nqe | 391 } // namespace nqe |
392 | 392 |
393 } // namespace net | 393 } // namespace net |
OLD | NEW |