Index: chrome/browser/history/history_field_trial.cc |
=================================================================== |
--- chrome/browser/history/history_field_trial.cc (revision 0) |
+++ chrome/browser/history/history_field_trial.cc (revision 0) |
@@ -0,0 +1,43 @@ |
+// Copyright (c) 2011 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/history/history_field_trial.h" |
+ |
+#include "base/metrics/field_trial.h" |
+ |
+namespace history { |
+ |
+namespace { |
+ |
+int g_low_mem_trial_group = 0; |
+bool g_low_mem_trial = false; |
+ |
+static const char kHistoryFieldTrialName[] = "History"; |
Scott Hess - ex-Googler
2011/10/26 21:44:59
AFAICT this is your namespace for field trials. U
|
+ |
+} // namespace |
+ |
+// static |
+void HistoryFieldTrial::Activate() { |
+ if (g_low_mem_trial_group) |
+ return; // Already initialized. |
Scott Hess - ex-Googler
2011/11/23 23:10:08
Note that FieldTrial::kDefaultGroupNumber is 0. I
|
+ |
+ scoped_refptr<base::FieldTrial> trial(new base::FieldTrial( |
+ kHistoryFieldTrialName, 1000, "Inactive", 2012, 2, 1)); |
Scott Hess - ex-Googler
2011/10/26 21:44:59
Since I don't see this stored anywhere, am I safe
jar (doing other things)
2011/10/27 00:23:55
The real field trial is actually ref-counted, and
|
+ |
+ g_low_mem_trial_group = trial->AppendGroup("LowMem", 50); // 5% |
+ if (trial->group() == g_low_mem_trial_group) |
+ g_low_mem_trial = true; |
+} |
+ |
+// static |
+bool HistoryFieldTrial::IsLowMemFieldTrial() { |
+ return g_low_mem_trial; |
+} |
+ |
+// static |
+std::string HistoryFieldTrial::GetGroupSuffix() { |
+ return g_low_mem_trial ? std::string("_LowMem") : std::string(); |
Scott Hess - ex-Googler
2011/10/26 21:44:59
Seems like it might be reasonable to have this con
jar (doing other things)
2011/10/27 00:23:55
+1
The MakeName() function was crafted to be nice
brettw
2011/10/28 22:30:40
I feel like I'm missing something fundamental that
Scott Hess - ex-Googler
2011/10/28 23:18:19
Probably! At least from my end, my suggestion was
|
+} |
+ |
+} // namespace history |
Property changes on: chrome\browser\history\history_field_trial.cc |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |