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

Unified Diff: net/disk_cache/backend_impl.cc

Issue 160485: Disk cache: Open the disk cache experiment for new users.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | « net/disk_cache/backend_impl.h ('k') | net/disk_cache/disk_cache_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_impl.cc
===================================================================
--- net/disk_cache/backend_impl.cc (revision 22075)
+++ net/disk_cache/backend_impl.cc (working copy)
@@ -147,12 +147,6 @@
}
if (*current_group <= 5) {
-#if defined(UNIT_TEST)
- // The unit test controls directly what to test.
- *current_group = 0;
- return true;
-#endif
-
// Re-load the two groups.
int option = base::RandInt(0, 9);
@@ -294,8 +288,11 @@
}
init_ = true;
- if (!InitExperiment(&data_->header.experiment))
- return false;
+ if (!(user_flags_ & disk_cache::kNoRandom)) {
+ // The unit test controls directly what to test.
+ if (!InitExperiment(&data_->header.experiment))
+ return false;
+ }
if (data_->header.experiment > 6 && data_->header.experiment < 9)
new_eviction_ = true;
@@ -949,6 +946,10 @@
new_eviction_ = true;
}
+void BackendImpl::SetFlags(uint32 flags) {
+ user_flags_ |= flags;
+}
+
void BackendImpl::ClearRefCountForTest() {
num_refs_ = 0;
}
@@ -987,6 +988,12 @@
IndexHeader header;
header.table_len = DesiredIndexTableLen(max_size_);
+ // All new profiles are going to use the new eviction.
+ if (!(user_flags_ & disk_cache::kNoRandom)) {
+ header.experiment = 8;
+ new_eviction_ = true;
+ }
+
// We need file version 2.1 for the new eviction algorithm.
if (new_eviction_)
header.version = 0x20001;
« no previous file with comments | « net/disk_cache/backend_impl.h ('k') | net/disk_cache/disk_cache_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698