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

Side by Side Diff: net/disk_cache/cache_creator.cc

Issue 14048014: Fix SimpleCache field trial creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: about:flags 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chrome_browser_field_trials.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/metrics/field_trial.h" 6 #include "base/metrics/field_trial.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/disk_cache/backend_impl.h" 9 #include "net/disk_cache/backend_impl.h"
10 #include "net/disk_cache/cache_util.h" 10 #include "net/disk_cache/cache_util.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 net_log_(net_log) { 72 net_log_(net_log) {
73 } 73 }
74 74
75 CacheCreator::~CacheCreator() { 75 CacheCreator::~CacheCreator() {
76 } 76 }
77 77
78 int CacheCreator::Run() { 78 int CacheCreator::Run() {
79 // TODO(pasko): The two caches should never coexist on disk. Each individual 79 // TODO(pasko): The two caches should never coexist on disk. Each individual
80 // cache backend should fail to initialize if it observes the index that does 80 // cache backend should fail to initialize if it observes the index that does
81 // not belong to it. 81 // not belong to it.
82 if (base::FieldTrialList::FindFullName("SimpleCacheTrial") == "Yes") { 82 const std::string experiment_name =
83 base::FieldTrialList::FindFullName("SimpleCacheTrial");
84 if (experiment_name == "ExplicitYes" || experiment_name == "ExperimentYes") {
83 // TODO(gavinp,pasko): While simple backend development proceeds, we're only 85 // TODO(gavinp,pasko): While simple backend development proceeds, we're only
84 // testing it against net::DISK_CACHE. Turn it on for more cache types as 86 // testing it against net::DISK_CACHE. Turn it on for more cache types as
85 // appropriate. 87 // appropriate.
86 if (type_ == net::DISK_CACHE) { 88 if (type_ == net::DISK_CACHE) {
87 disk_cache::SimpleBackendImpl* simple_cache = 89 disk_cache::SimpleBackendImpl* simple_cache =
88 new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_, thread_, 90 new disk_cache::SimpleBackendImpl(path_, max_bytes_, type_, thread_,
89 net_log_); 91 net_log_);
90 created_cache_ = simple_cache; 92 created_cache_ = simple_cache;
91 return simple_cache->Init( 93 return simple_cache->Init(
92 base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this))); 94 base::Bind(&CacheCreator::OnIOComplete, base::Unretained(this)));
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 *backend = disk_cache::MemBackendImpl::CreateBackend(max_bytes, net_log); 157 *backend = disk_cache::MemBackendImpl::CreateBackend(max_bytes, net_log);
156 return *backend ? net::OK : net::ERR_FAILED; 158 return *backend ? net::OK : net::ERR_FAILED;
157 } 159 }
158 DCHECK(thread); 160 DCHECK(thread);
159 CacheCreator* creator = new CacheCreator(path, force, max_bytes, type, kNone, 161 CacheCreator* creator = new CacheCreator(path, force, max_bytes, type, kNone,
160 thread, net_log, backend, callback); 162 thread, net_log, backend, callback);
161 return creator->Run(); 163 return creator->Run();
162 } 164 }
163 165
164 } // namespace disk_cache 166 } // namespace disk_cache
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_field_trials.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698