OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/disk_cache/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 // Initializes the field trial structures to allow performance measurements | 167 // Initializes the field trial structures to allow performance measurements |
168 // for the current cache configuration. Returns true if we are active part of | 168 // for the current cache configuration. Returns true if we are active part of |
169 // the CacheThrottle field trial. | 169 // the CacheThrottle field trial. |
170 bool SetFieldTrialInfo(int size_group) { | 170 bool SetFieldTrialInfo(int size_group) { |
171 static bool first = true; | 171 static bool first = true; |
172 if (!first) | 172 if (!first) |
173 return false; | 173 return false; |
174 | 174 |
175 // Field trials involve static objects so we have to do this only once. | 175 // Field trials involve static objects so we have to do this only once. |
176 first = false; | 176 first = false; |
177 std::string group1 = base::StringPrintf("CacheSizeGroup_%d", size_group); | |
177 scoped_refptr<base::FieldTrial> trial1( | 178 scoped_refptr<base::FieldTrial> trial1( |
178 new base::FieldTrial("CacheSize", 10)); | 179 new base::FieldTrial("CacheSize", 10, group1, 2011, 6, 30)); |
179 std::string group1 = base::StringPrintf("CacheSizeGroup_%d", size_group); | 180 trial1->group(); |
jar (doing other things)
2011/01/15 20:52:47
nit: API should not require users to explicitly ca
| |
180 trial1->AppendGroup(group1, base::FieldTrial::kAllRemainingProbability); | |
181 | 181 |
182 // After June 30, 2011 builds, it will always be in defaut group. | |
182 scoped_refptr<base::FieldTrial> trial2( | 183 scoped_refptr<base::FieldTrial> trial2( |
183 new base::FieldTrial("CacheThrottle", 100)); | 184 new base::FieldTrial("CacheThrottle", 100, "CacheThrottle_Default", 2011, |
185 6, 30)); | |
184 int group2a = trial2->AppendGroup("CacheThrottle_On", 10); // 10 % in. | 186 int group2a = trial2->AppendGroup("CacheThrottle_On", 10); // 10 % in. |
185 trial2->AppendGroup("CacheThrottle_Off", 10); // 10 % control. | 187 trial2->AppendGroup("CacheThrottle_Off", 10); // 10 % control. |
186 | 188 |
187 return trial2->group() == group2a; | 189 return trial2->group() == group2a; |
188 } | 190 } |
189 | 191 |
190 // ------------------------------------------------------------------------ | 192 // ------------------------------------------------------------------------ |
191 | 193 |
192 // This class takes care of building an instance of the backend. | 194 // This class takes care of building an instance of the backend. |
193 class CacheCreator { | 195 class CacheCreator { |
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2095 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2097 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2096 total_memory = kMaxBuffersSize; | 2098 total_memory = kMaxBuffersSize; |
2097 | 2099 |
2098 done = true; | 2100 done = true; |
2099 } | 2101 } |
2100 | 2102 |
2101 return static_cast<int>(total_memory); | 2103 return static_cast<int>(total_memory); |
2102 } | 2104 } |
2103 | 2105 |
2104 } // namespace disk_cache | 2106 } // namespace disk_cache |
OLD | NEW |