Chromium Code Reviews| Index: net/disk_cache/simple/simple_experiment.cc |
| diff --git a/net/disk_cache/simple/simple_experiment.cc b/net/disk_cache/simple/simple_experiment.cc |
| index 38ea589322f97df405f9b48bcaa349510847ce52..f48b9a31e2e661eeca321d61b208bfe712a2d660 100644 |
| --- a/net/disk_cache/simple/simple_experiment.cc |
| +++ b/net/disk_cache/simple/simple_experiment.cc |
| @@ -15,10 +15,24 @@ namespace disk_cache { |
| const base::Feature kSimpleSizeExperiment = {"SimpleSizeExperiment", |
| base::FEATURE_DISABLED_BY_DEFAULT}; |
| +const base::Feature kSimpleCacheEvictionWithSize = { |
| + "SimpleCacheEvictionWithSize", base::FEATURE_DISABLED_BY_DEFAULT}; |
| + |
| const char kSizeMultiplierParam[] = "SizeMultiplier"; |
| namespace { |
| +// Updates experiment if the experiment is active. |
| +void CheckForSimpleCacheEvictionWithSizeExperiment( |
|
pasko
2017/06/29 15:27:25
nit: "SimpleCache" looks redundant here, I'd sugge
hubbe
2017/06/29 18:55:27
Done.
|
| + disk_cache::SimpleExperiment* experiment) { |
| + if (experiment->type != disk_cache::SimpleExperimentType::NONE) |
| + return; |
| + |
| + if (base::FeatureList::GetFieldTrial(kSimpleCacheEvictionWithSize)) { |
|
pasko
2017/06/29 15:27:25
nit: the common convention is not to put curly bra
hubbe
2017/06/29 18:55:26
Done.
|
| + experiment->type = SimpleExperimentType::EVICT_WITH_SIZE; |
|
jkarlin
2017/06/29 16:26:11
You should also parse the parameter and use the pa
hubbe
2017/06/29 18:55:26
My intention was to have the control group disable
jkarlin
2017/06/29 19:17:01
But then you wouldn't clear the control's cache? S
hubbe
2017/06/29 19:26:48
I don't understand, why wouldn't it?
My intention
jkarlin
2017/06/30 11:57:27
Ah, I think I understand now. You want to use the
hubbe
2017/06/30 17:30:34
No, I wasn't planning on using the same field tria
jkarlin
2017/06/30 18:18:48
Correct. And setting the parameter to 100 is a noo
hubbe
2017/06/30 19:00:43
I just change experiment->type.
The control group
|
| + } |
| +} |
| + |
| // Returns true if the experiment is found and properly defined. |
| bool CheckForSimpleSizeExperiment(disk_cache::SimpleExperiment* experiment) { |
| DCHECK_EQ(disk_cache::SimpleExperimentType::NONE, experiment->type); |
| @@ -58,6 +72,7 @@ SimpleExperiment GetSimpleExperiment(net::CacheType cache_type) { |
| return experiment; |
| CheckForSimpleSizeExperiment(&experiment); |
|
pasko
2017/06/29 15:27:25
jkarlin: why are we ignoring the return value here
jkarlin
2017/06/29 16:26:12
You're right, we should early return if it returns
|
| + CheckForSimpleCacheEvictionWithSizeExperiment(&experiment); |
|
pasko
2017/06/29 15:27:24
this has the ability to drop the cache in the expe
jkarlin
2017/06/29 16:26:11
Discussed in a comment above.
hubbe
2017/06/29 18:55:26
Acknowledged.
hubbe
2017/06/29 18:55:27
See comment on line 32.
|
| return experiment; |
| } |