| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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/field_trial.h" | 7 #include "base/field_trial.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 namespace disk_cache { | 168 namespace disk_cache { |
| 169 | 169 |
| 170 Backend* CreateCacheBackend(const FilePath& full_path, bool force, | 170 Backend* CreateCacheBackend(const FilePath& full_path, bool force, |
| 171 int max_bytes, net::CacheType type) { | 171 int max_bytes, net::CacheType type) { |
| 172 // Create a backend without extra flags. | 172 // Create a backend without extra flags. |
| 173 return BackendImpl::CreateBackend(full_path, force, max_bytes, type, kNone); | 173 return BackendImpl::CreateBackend(full_path, force, max_bytes, type, kNone); |
| 174 } | 174 } |
| 175 | 175 |
| 176 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, | 176 int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes, |
| 177 bool force, Backend** backend, | 177 bool force, MessageLoop* thread, Backend** backend, |
| 178 CompletionCallback* callback) { | 178 CompletionCallback* callback) { |
| 179 if (type == net::MEMORY_CACHE) | 179 if (type == net::MEMORY_CACHE) |
| 180 *backend = CreateInMemoryCacheBackend(max_bytes); | 180 *backend = CreateInMemoryCacheBackend(max_bytes); |
| 181 else | 181 else |
| 182 *backend = BackendImpl::CreateBackend(path, force, max_bytes, type, kNone); | 182 *backend = BackendImpl::CreateBackend(path, force, max_bytes, type, kNone); |
| 183 return *backend ? net::OK : net::ERR_FAILED; | 183 return *backend ? net::OK : net::ERR_FAILED; |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Returns the preferred maximum number of bytes for the cache given the | 186 // Returns the preferred maximum number of bytes for the cache given the |
| 187 // number of available bytes. | 187 // number of available bytes. |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1691 | 1691 |
| 1692 return num_dirty; | 1692 return num_dirty; |
| 1693 } | 1693 } |
| 1694 | 1694 |
| 1695 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { | 1695 bool BackendImpl::CheckEntry(EntryImpl* cache_entry) { |
| 1696 RankingsNode* rankings = cache_entry->rankings()->Data(); | 1696 RankingsNode* rankings = cache_entry->rankings()->Data(); |
| 1697 return !rankings->dummy; | 1697 return !rankings->dummy; |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 } // namespace disk_cache | 1700 } // namespace disk_cache |
| OLD | NEW |