Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/net/async_dns_field_trial.h" | 5 #include "chrome/browser/net/async_dns_field_trial.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/memory/ref_counted.h" | |
|
SteveT
2012/10/25 03:00:27
nit: Header out of order?
szym
2012/10/25 17:17:45
Done.
| |
| 8 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 9 #include "chrome/common/chrome_version_info.h" | |
| 10 | 10 |
| 11 namespace chrome_browser_net { | 11 namespace chrome_browser_net { |
| 12 | 12 |
|
SteveT
2012/10/25 03:00:27
check: BTW the header comment is still applies in
szym
2012/10/25 03:03:13
Thanks for catching that. The header comment is 2
szym
2012/10/25 17:17:45
Done.
| |
| 13 bool ConfigureAsyncDnsFieldTrial() { | 13 bool ConfigureAsyncDnsFieldTrial() { |
| 14 #if defined(OS_ANDROID) || defined(OS_IOS) | 14 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 15 // There is no DnsConfigService on those platforms so disable the field trial. | 15 // There is no DnsConfigService on those platforms so disable the field trial. |
| 16 return false; | 16 return false; |
| 17 #endif | 17 #endif |
| 18 const base::FieldTrial::Probability kAsyncDnsDivisor = 100; | 18 scoped_refptr<base::FieldTrial> trial(base::FieldTrialList::Find("AsyncDns")); |
|
Alexei Svitkine (slow)
2012/10/25 14:37:46
You could simplify all of this by just getting the
szym
2012/10/25 17:17:45
Done.
| |
| 19 base::FieldTrial::Probability enabled_probability = 0; | |
| 20 | 19 |
| 21 if (chrome::VersionInfo::GetChannel() <= chrome::VersionInfo::CHANNEL_DEV) | 20 if (!trial.get()) |
| 22 enabled_probability = 50; | 21 return false; |
| 23 | 22 |
|
SteveT
2012/10/25 03:00:27
nit: Maybe have a comment here on how the two choi
szym
2012/10/25 17:17:45
Done.
| |
| 24 scoped_refptr<base::FieldTrial> trial( | 23 const std::string kAsyncDnsPrefix("AsyncDns"); |
| 25 base::FieldTrialList::FactoryGetFieldTrial( | 24 return trial->group_name().compare(0, kAsyncDnsPrefix.length(), |
| 26 "AsyncDns", kAsyncDnsDivisor, "disabled", 2012, 10, 30, NULL)); | 25 kAsyncDnsPrefix) == 0; |
| 27 | |
| 28 int enabled_group = trial->AppendGroup("enabled", enabled_probability); | |
| 29 return trial->group() == enabled_group; | |
| 30 } | 26 } |
| 31 | 27 |
| 32 } // namespace chrome_browser_net | 28 } // namespace chrome_browser_net |
| OLD | NEW |