| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/disk_cache/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 // ------------------------------------------------------------------------ | 298 // ------------------------------------------------------------------------ |
| 299 | 299 |
| 300 namespace disk_cache { | 300 namespace disk_cache { |
| 301 | 301 |
| 302 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, | 302 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, |
| 303 bool force, base::MessageLoopProxy* thread, | 303 bool force, base::MessageLoopProxy* thread, |
| 304 net::NetLog* net_log, Backend** backend, | 304 net::NetLog* net_log, Backend** backend, |
| 305 CompletionCallback* callback) { | 305 CompletionCallback* callback) { |
| 306 DCHECK(callback); | 306 DCHECK(callback); |
| 307 if (type == net::MEMORY_CACHE) { | 307 if (type == net::MEMORY_CACHE) { |
| 308 *backend = MemBackendImpl::CreateBackend(max_bytes); | 308 *backend = MemBackendImpl::CreateBackend(max_bytes, net_log); |
| 309 return *backend ? net::OK : net::ERR_FAILED; | 309 return *backend ? net::OK : net::ERR_FAILED; |
| 310 } | 310 } |
| 311 DCHECK(thread); | 311 DCHECK(thread); |
| 312 | 312 |
| 313 return BackendImpl::CreateBackend(path, force, max_bytes, type, kNone, thread, | 313 return BackendImpl::CreateBackend(path, force, max_bytes, type, kNone, thread, |
| 314 net_log, backend, callback); | 314 net_log, backend, callback); |
| 315 } | 315 } |
| 316 | 316 |
| 317 // Returns the preferred maximum number of bytes for the cache given the | 317 // Returns the preferred maximum number of bytes for the cache given the |
| 318 // number of available bytes. | 318 // number of available bytes. |
| (...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2121 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2122 total_memory = kMaxBuffersSize; | 2122 total_memory = kMaxBuffersSize; |
| 2123 | 2123 |
| 2124 done = true; | 2124 done = true; |
| 2125 } | 2125 } |
| 2126 | 2126 |
| 2127 return static_cast<int>(total_memory); | 2127 return static_cast<int>(total_memory); |
| 2128 } | 2128 } |
| 2129 | 2129 |
| 2130 } // namespace disk_cache | 2130 } // namespace disk_cache |
| OLD | NEW |