| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 return not_deleted; | 1374 return not_deleted; |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 int BackendImpl::OpenEntry(const std::string& key, Entry** entry, | 1377 int BackendImpl::OpenEntry(const std::string& key, Entry** entry, |
| 1378 OldCompletionCallback* callback) { | 1378 OldCompletionCallback* callback) { |
| 1379 DCHECK(callback); | 1379 DCHECK(callback); |
| 1380 background_queue_.OpenEntry(key, entry, callback); | 1380 background_queue_.OpenEntry(key, entry, callback); |
| 1381 return net::ERR_IO_PENDING; | 1381 return net::ERR_IO_PENDING; |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 int BackendImpl::OpenEntry(const std::string& key, Entry** entry, | |
| 1385 const net::CompletionCallback& callback) { | |
| 1386 DCHECK(!callback.is_null()); | |
| 1387 background_queue_.OpenEntry(key, entry, callback); | |
| 1388 return net::ERR_IO_PENDING; | |
| 1389 } | |
| 1390 | |
| 1391 int BackendImpl::CreateEntry(const std::string& key, Entry** entry, | 1384 int BackendImpl::CreateEntry(const std::string& key, Entry** entry, |
| 1392 OldCompletionCallback* callback) { | 1385 OldCompletionCallback* callback) { |
| 1393 DCHECK(callback); | 1386 DCHECK(callback); |
| 1394 background_queue_.CreateEntry(key, entry, callback); | 1387 background_queue_.CreateEntry(key, entry, callback); |
| 1395 return net::ERR_IO_PENDING; | 1388 return net::ERR_IO_PENDING; |
| 1396 } | 1389 } |
| 1397 | 1390 |
| 1398 int BackendImpl::CreateEntry(const std::string& key, Entry** entry, | |
| 1399 const net::CompletionCallback& callback) { | |
| 1400 DCHECK(!callback.is_null()); | |
| 1401 background_queue_.CreateEntry(key, entry, callback); | |
| 1402 return net::ERR_IO_PENDING; | |
| 1403 } | |
| 1404 | |
| 1405 int BackendImpl::DoomEntry(const std::string& key, | 1391 int BackendImpl::DoomEntry(const std::string& key, |
| 1406 OldCompletionCallback* callback) { | 1392 OldCompletionCallback* callback) { |
| 1407 DCHECK(callback); | 1393 DCHECK(callback); |
| 1408 background_queue_.DoomEntry(key, callback); | 1394 background_queue_.DoomEntry(key, callback); |
| 1409 return net::ERR_IO_PENDING; | 1395 return net::ERR_IO_PENDING; |
| 1410 } | 1396 } |
| 1411 | 1397 |
| 1412 int BackendImpl::DoomAllEntries(OldCompletionCallback* callback) { | 1398 int BackendImpl::DoomAllEntries(OldCompletionCallback* callback) { |
| 1413 DCHECK(callback); | 1399 DCHECK(callback); |
| 1414 background_queue_.DoomAllEntries(callback); | 1400 background_queue_.DoomAllEntries(callback); |
| 1415 return net::ERR_IO_PENDING; | 1401 return net::ERR_IO_PENDING; |
| 1416 } | 1402 } |
| 1417 | 1403 |
| 1418 int BackendImpl::DoomAllEntries(const net::CompletionCallback& callback) { | |
| 1419 DCHECK(!callback.is_null()); | |
| 1420 background_queue_.DoomAllEntries(callback); | |
| 1421 return net::ERR_IO_PENDING; | |
| 1422 } | |
| 1423 | |
| 1424 int BackendImpl::DoomEntriesBetween(const base::Time initial_time, | 1404 int BackendImpl::DoomEntriesBetween(const base::Time initial_time, |
| 1425 const base::Time end_time, | 1405 const base::Time end_time, |
| 1426 OldCompletionCallback* callback) { | 1406 OldCompletionCallback* callback) { |
| 1427 DCHECK(callback); | 1407 DCHECK(callback); |
| 1428 background_queue_.DoomEntriesBetween(initial_time, end_time, callback); | 1408 background_queue_.DoomEntriesBetween(initial_time, end_time, callback); |
| 1429 return net::ERR_IO_PENDING; | 1409 return net::ERR_IO_PENDING; |
| 1430 } | 1410 } |
| 1431 | 1411 |
| 1432 int BackendImpl::DoomEntriesBetween(const base::Time initial_time, | |
| 1433 const base::Time end_time, | |
| 1434 const net::CompletionCallback& callback) { | |
| 1435 DCHECK(!callback.is_null()); | |
| 1436 background_queue_.DoomEntriesBetween(initial_time, end_time, callback); | |
| 1437 return net::ERR_IO_PENDING; | |
| 1438 } | |
| 1439 | |
| 1440 int BackendImpl::DoomEntriesSince(const base::Time initial_time, | 1412 int BackendImpl::DoomEntriesSince(const base::Time initial_time, |
| 1441 OldCompletionCallback* callback) { | 1413 OldCompletionCallback* callback) { |
| 1442 DCHECK(callback); | 1414 DCHECK(callback); |
| 1443 background_queue_.DoomEntriesSince(initial_time, callback); | 1415 background_queue_.DoomEntriesSince(initial_time, callback); |
| 1444 return net::ERR_IO_PENDING; | 1416 return net::ERR_IO_PENDING; |
| 1445 } | 1417 } |
| 1446 | 1418 |
| 1447 int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, | 1419 int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, |
| 1448 OldCompletionCallback* callback) { | 1420 OldCompletionCallback* callback) { |
| 1449 DCHECK(callback); | 1421 DCHECK(callback); |
| 1450 background_queue_.OpenNextEntry(iter, next_entry, callback); | 1422 background_queue_.OpenNextEntry(iter, next_entry, callback); |
| 1451 return net::ERR_IO_PENDING; | 1423 return net::ERR_IO_PENDING; |
| 1452 } | 1424 } |
| 1453 | 1425 |
| 1454 int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, | |
| 1455 const net::CompletionCallback& callback) { | |
| 1456 DCHECK(!callback.is_null()); | |
| 1457 background_queue_.OpenNextEntry(iter, next_entry, callback); | |
| 1458 return net::ERR_IO_PENDING; | |
| 1459 } | |
| 1460 | |
| 1461 void BackendImpl::EndEnumeration(void** iter) { | 1426 void BackendImpl::EndEnumeration(void** iter) { |
| 1462 background_queue_.EndEnumeration(*iter); | 1427 background_queue_.EndEnumeration(*iter); |
| 1463 *iter = NULL; | 1428 *iter = NULL; |
| 1464 } | 1429 } |
| 1465 | 1430 |
| 1466 void BackendImpl::GetStats(StatsItems* stats) { | 1431 void BackendImpl::GetStats(StatsItems* stats) { |
| 1467 if (disabled_) | 1432 if (disabled_) |
| 1468 return; | 1433 return; |
| 1469 | 1434 |
| 1470 std::pair<std::string, std::string> item; | 1435 std::pair<std::string, std::string> item; |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2269 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2234 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2270 total_memory = kMaxBuffersSize; | 2235 total_memory = kMaxBuffersSize; |
| 2271 | 2236 |
| 2272 done = true; | 2237 done = true; |
| 2273 } | 2238 } |
| 2274 | 2239 |
| 2275 return static_cast<int>(total_memory); | 2240 return static_cast<int>(total_memory); |
| 2276 } | 2241 } |
| 2277 | 2242 |
| 2278 } // namespace disk_cache | 2243 } // namespace disk_cache |
| OLD | NEW |