OLD | NEW |
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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/metrics/field_trial.h" | 6 #include "base/metrics/field_trial.h" |
7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "net/base/cache_type.h" | 9 #include "net/base/cache_type.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 bool force, | 171 bool force, |
172 const scoped_refptr<base::SingleThreadTaskRunner>& thread, | 172 const scoped_refptr<base::SingleThreadTaskRunner>& thread, |
173 net::NetLog* net_log, | 173 net::NetLog* net_log, |
174 scoped_ptr<Backend>* backend, | 174 scoped_ptr<Backend>* backend, |
175 const net::CompletionCallback& callback) { | 175 const net::CompletionCallback& callback) { |
176 DCHECK(!callback.is_null()); | 176 DCHECK(!callback.is_null()); |
177 if (type == net::MEMORY_CACHE) { | 177 if (type == net::MEMORY_CACHE) { |
178 *backend = disk_cache::MemBackendImpl::CreateBackend(max_bytes, net_log); | 178 *backend = disk_cache::MemBackendImpl::CreateBackend(max_bytes, net_log); |
179 return *backend ? net::OK : net::ERR_FAILED; | 179 return *backend ? net::OK : net::ERR_FAILED; |
180 } | 180 } |
181 DCHECK(thread); | 181 DCHECK(thread.get()); |
182 CacheCreator* creator = new CacheCreator(path, | 182 CacheCreator* creator = new CacheCreator(path, |
183 force, | 183 force, |
184 max_bytes, | 184 max_bytes, |
185 type, | 185 type, |
186 backend_type, | 186 backend_type, |
187 kNone, | 187 kNone, |
188 thread, | 188 thread, |
189 net_log, | 189 net_log, |
190 backend, | 190 backend, |
191 callback); | 191 callback); |
192 return creator->Run(); | 192 return creator->Run(); |
193 } | 193 } |
194 | 194 |
195 } // namespace disk_cache | 195 } // namespace disk_cache |
OLD | NEW |