Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Unified Diff: chrome/browser/net/async_dns_field_trial.cc

Issue 10828373: [net] Add AsyncDns field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable field trial for mobile devices Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/async_dns_field_trial.cc
diff --git a/chrome/browser/net/async_dns_field_trial.cc b/chrome/browser/net/async_dns_field_trial.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c5cd0777018596c9038c81240a60c63b3a60ecad
--- /dev/null
+++ b/chrome/browser/net/async_dns_field_trial.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/net/async_dns_field_trial.h"
+
+#include "base/metrics/field_trial.h"
+#include "build/build_config.h"
+#include "chrome/common/chrome_version_info.h"
+
+namespace net {
+
+bool ConfigureAsyncDnsFieldTrial() {
+#if defined(OS_ANDROID) || defined(OS_IOS)
cbentzel 2012/08/22 17:16:55 CrOS as well?
+ // There is no DnsConfigService on those platforms so disable the field trial.
+ return false;
+#else
cbentzel 2012/08/22 17:16:55 I would just do a #endif here rather than an else.
+ const base::FieldTrial::Probability kAsyncDnsDivisor = 100;
+ base::FieldTrial::Probability enabled_probability = 0;
+
+ chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
+ if (channel == chrome::VersionInfo::CHANNEL_DEV ||
+ channel == chrome::VersionInfo::CHANNEL_CANARY) {
szym 2012/08/21 20:09:40 Should this be |channel <= CHANNEL_DEV| to allow T
cbentzel 2012/08/22 17:16:55 Fine with this.
+ enabled_probability = 50;
+ }
+
+ scoped_refptr<base::FieldTrial> trial(
+ base::FieldTrialList::FactoryGetFieldTrial(
+ "AsyncDns", kAsyncDnsDivisor, "disabled", 2012, 9, 30, NULL));
+
+ int enabled_group = trial->AppendGroup("enabled", enabled_probability);
+ return trial->group() == enabled_group;
+#endif
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698