Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/simple/simple_experiment.h" | 5 #include "net/disk_cache/simple/simple_experiment.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/metrics/field_trial_param_associator.h" | 11 #include "base/metrics/field_trial_param_associator.h" |
| 12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 | 13 |
| 14 namespace disk_cache { | 14 namespace disk_cache { |
| 15 | 15 |
| 16 const base::Feature kSimpleSizeExperiment = {"SimpleSizeExperiment", | 16 const base::Feature kSimpleSizeExperiment = {"SimpleSizeExperiment", |
|
pasko
2017/06/23 15:10:30
maybe allow a param like log/sqrt/whatever that yo
hubbe
2017/06/23 18:25:52
log & sqrt are too slow, don't make mathematical s
| |
| 17 base::FEATURE_DISABLED_BY_DEFAULT}; | 17 base::FEATURE_DISABLED_BY_DEFAULT}; |
| 18 const base::Feature kSimpleCacheEvictionWithSize = { | |
| 19 "SimpleCacheEvictionWithSize", base::FEATURE_DISABLED_BY_DEFAULT}; | |
|
pasko
2017/06/23 15:10:30
does finch config allow enabling more than one fea
hubbe
2017/06/23 18:25:52
I don't intend to drop caches in the finch experim
pasko
2017/06/26 13:32:13
Thank you. I have a few reservations about it, so
| |
| 20 | |
| 18 const char kSizeMultiplierParam[] = "SizeMultiplier"; | 21 const char kSizeMultiplierParam[] = "SizeMultiplier"; |
| 19 | 22 |
| 20 namespace { | 23 namespace { |
| 21 | 24 |
| 22 // Returns true if the experiment is found and properly defined. | 25 // Returns true if the experiment is found and properly defined. |
| 23 bool CheckForSimpleSizeExperiment(disk_cache::SimpleExperiment* experiment) { | 26 bool CheckForSimpleSizeExperiment(disk_cache::SimpleExperiment* experiment) { |
| 24 DCHECK_EQ(disk_cache::SimpleExperimentType::NONE, experiment->type); | 27 DCHECK_EQ(disk_cache::SimpleExperimentType::NONE, experiment->type); |
| 25 DCHECK_EQ(0u, experiment->param); | 28 DCHECK_EQ(0u, experiment->param); |
| 26 | 29 |
| 27 if (!base::FeatureList::IsEnabled(kSimpleSizeExperiment)) | 30 if (!base::FeatureList::IsEnabled(kSimpleSizeExperiment)) |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 55 SimpleExperiment experiment; | 58 SimpleExperiment experiment; |
| 56 | 59 |
| 57 if (cache_type != net::DISK_CACHE) | 60 if (cache_type != net::DISK_CACHE) |
| 58 return experiment; | 61 return experiment; |
| 59 | 62 |
| 60 CheckForSimpleSizeExperiment(&experiment); | 63 CheckForSimpleSizeExperiment(&experiment); |
| 61 return experiment; | 64 return experiment; |
| 62 } | 65 } |
| 63 | 66 |
| 64 } // namespace disk_cache | 67 } // namespace disk_cache |
| OLD | NEW |