| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // ------------------------------------------------------------------------ | 288 // ------------------------------------------------------------------------ |
| 289 | 289 |
| 290 namespace disk_cache { | 290 namespace disk_cache { |
| 291 | 291 |
| 292 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, | 292 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, |
| 293 bool force, base::MessageLoopProxy* thread, | 293 bool force, base::MessageLoopProxy* thread, |
| 294 net::NetLog* net_log, Backend** backend, | 294 net::NetLog* net_log, Backend** backend, |
| 295 CompletionCallback* callback) { | 295 CompletionCallback* callback) { |
| 296 DCHECK(callback); | 296 DCHECK(callback); |
| 297 if (type == net::MEMORY_CACHE) { | 297 if (type == net::MEMORY_CACHE) { |
| 298 *backend = MemBackendImpl::CreateBackend(max_bytes); | 298 *backend = MemBackendImpl::CreateBackend(max_bytes, net_log); |
| 299 return *backend ? net::OK : net::ERR_FAILED; | 299 return *backend ? net::OK : net::ERR_FAILED; |
| 300 } | 300 } |
| 301 DCHECK(thread); | 301 DCHECK(thread); |
| 302 | 302 |
| 303 return BackendImpl::CreateBackend(path, force, max_bytes, type, kNone, thread, | 303 return BackendImpl::CreateBackend(path, force, max_bytes, type, kNone, thread, |
| 304 net_log, backend, callback); | 304 net_log, backend, callback); |
| 305 } | 305 } |
| 306 | 306 |
| 307 // Returns the preferred maximum number of bytes for the cache given the | 307 // Returns the preferred maximum number of bytes for the cache given the |
| 308 // number of available bytes. | 308 // number of available bytes. |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2077 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2077 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2078 total_memory = kMaxBuffersSize; | 2078 total_memory = kMaxBuffersSize; |
| 2079 | 2079 |
| 2080 done = true; | 2080 done = true; |
| 2081 } | 2081 } |
| 2082 | 2082 |
| 2083 return static_cast<int>(total_memory); | 2083 return static_cast<int>(total_memory); |
| 2084 } | 2084 } |
| 2085 | 2085 |
| 2086 } // namespace disk_cache | 2086 } // namespace disk_cache |
| OLD | NEW |