Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/history/history_field_trial.h" | |
| 6 | |
| 7 #include "base/metrics/field_trial.h" | |
| 8 | |
| 9 namespace history { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 int g_low_mem_trial_group = 0; | |
| 14 bool g_low_mem_trial = false; | |
| 15 | |
| 16 static const char kHistoryFieldTrialName[] = "History"; | |
|
Scott Hess - ex-Googler
2011/10/26 21:44:59
AFAICT this is your namespace for field trials. U
| |
| 17 | |
| 18 } // namespace | |
| 19 | |
| 20 // static | |
| 21 void HistoryFieldTrial::Activate() { | |
| 22 if (g_low_mem_trial_group) | |
| 23 return; // Already initialized. | |
|
Scott Hess - ex-Googler
2011/11/23 23:10:08
Note that FieldTrial::kDefaultGroupNumber is 0. I
| |
| 24 | |
| 25 scoped_refptr<base::FieldTrial> trial(new base::FieldTrial( | |
| 26 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
| |
| 27 | |
| 28 g_low_mem_trial_group = trial->AppendGroup("LowMem", 50); // 5% | |
| 29 if (trial->group() == g_low_mem_trial_group) | |
| 30 g_low_mem_trial = true; | |
| 31 } | |
| 32 | |
| 33 // static | |
| 34 bool HistoryFieldTrial::IsLowMemFieldTrial() { | |
| 35 return g_low_mem_trial; | |
| 36 } | |
| 37 | |
| 38 // static | |
| 39 std::string HistoryFieldTrial::GetGroupSuffix() { | |
| 40 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
| |
| 41 } | |
| 42 | |
| 43 } // namespace history | |
| OLD | NEW |