Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(545)

Unified Diff: net/disk_cache/backend_impl.cc

Issue 14129004: Add support for the control group in the Simple Cache Experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remediate & fix Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/disk_cache/experiments.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_impl.cc
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index fed0546fc00daa6e96c29b24d293d4c0407b72b1..ce2aafde001c4936e1d271ed5d04b5ce33d6fc0b 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -76,13 +76,23 @@ size_t GetIndexSize(int table_len) {
// Sets group for the current experiment. Returns false if the files should be
// discarded.
-bool InitExperiment(disk_cache::IndexHeader* header) {
+bool InitExperiment(disk_cache::IndexHeader* header, bool cache_created) {
if (header->experiment == disk_cache::EXPERIMENT_OLD_FILE1 ||
header->experiment == disk_cache::EXPERIMENT_OLD_FILE2) {
// Discard current cache.
return false;
}
+ if (base::FieldTrialList::FindFullName("SimpleCacheTrial") ==
+ "ExperimentControl") {
+ if (cache_created) {
+ header->experiment = disk_cache::EXPERIMENT_SIMPLE_CONTROL;
+ return true;
+ } else if (header->experiment != disk_cache::EXPERIMENT_SIMPLE_CONTROL) {
+ return false;
+ }
+ }
+
header->experiment = disk_cache::NO_EXPERIMENT;
return true;
}
@@ -258,9 +268,10 @@ int BackendImpl::SyncInit() {
if (!restarted_ && (create_files || !data_->header.num_entries))
ReportError(ERR_CACHE_CREATED);
- if (!(user_flags_ & kNoRandom) &&
- cache_type_ == net::DISK_CACHE && !InitExperiment(&data_->header))
+ if (!(user_flags_ & kNoRandom) && cache_type_ == net::DISK_CACHE &&
+ !InitExperiment(&data_->header, create_files)) {
return net::ERR_FAILED;
+ }
// We don't care if the value overflows. The only thing we care about is that
// the id cannot be zero, because that value is used as "not dirty".
« no previous file with comments | « no previous file | net/disk_cache/experiments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698