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 "net/disk_cache/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 return CheckAllEntries(); | 1316 return CheckAllEntries(); |
1317 } | 1317 } |
1318 | 1318 |
1319 void BackendImpl::FlushIndex() { | 1319 void BackendImpl::FlushIndex() { |
1320 if (index_ && !disabled_) | 1320 if (index_ && !disabled_) |
1321 index_->Flush(); | 1321 index_->Flush(); |
1322 } | 1322 } |
1323 | 1323 |
1324 // ------------------------------------------------------------------------ | 1324 // ------------------------------------------------------------------------ |
1325 | 1325 |
| 1326 net::CacheType BackendImpl::GetCacheType() const { |
| 1327 return cache_type_; |
| 1328 } |
| 1329 |
1326 int32 BackendImpl::GetEntryCount() const { | 1330 int32 BackendImpl::GetEntryCount() const { |
1327 if (!index_ || disabled_) | 1331 if (!index_ || disabled_) |
1328 return 0; | 1332 return 0; |
1329 // num_entries includes entries already evicted. | 1333 // num_entries includes entries already evicted. |
1330 int32 not_deleted = data_->header.num_entries - | 1334 int32 not_deleted = data_->header.num_entries - |
1331 data_->header.lru.sizes[Rankings::DELETED]; | 1335 data_->header.lru.sizes[Rankings::DELETED]; |
1332 | 1336 |
1333 if (not_deleted < 0) { | 1337 if (not_deleted < 0) { |
1334 NOTREACHED(); | 1338 NOTREACHED(); |
1335 not_deleted = 0; | 1339 not_deleted = 0; |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2198 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2202 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2199 total_memory = kMaxBuffersSize; | 2203 total_memory = kMaxBuffersSize; |
2200 | 2204 |
2201 done = true; | 2205 done = true; |
2202 } | 2206 } |
2203 | 2207 |
2204 return static_cast<int>(total_memory); | 2208 return static_cast<int>(total_memory); |
2205 } | 2209 } |
2206 | 2210 |
2207 } // namespace disk_cache | 2211 } // namespace disk_cache |
OLD | NEW |