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/blockfile/backend_impl.h" | 5 #include "net/disk_cache/blockfile/backend_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 if (it != open_entries_.end()) { | 1534 if (it != open_entries_.end()) { |
1535 // Easy job. This entry is already in memory. | 1535 // Easy job. This entry is already in memory. |
1536 EntryImpl* this_entry = it->second; | 1536 EntryImpl* this_entry = it->second; |
1537 this_entry->AddRef(); | 1537 this_entry->AddRef(); |
1538 *entry = this_entry; | 1538 *entry = this_entry; |
1539 return 0; | 1539 return 0; |
1540 } | 1540 } |
1541 | 1541 |
1542 STRESS_DCHECK(block_files_.IsValid(address)); | 1542 STRESS_DCHECK(block_files_.IsValid(address)); |
1543 | 1543 |
1544 if (!address.SanityCheckForEntryV2()) { | 1544 if (!address.SanityCheckForEntry()) { |
1545 LOG(WARNING) << "Wrong entry address."; | 1545 LOG(WARNING) << "Wrong entry address."; |
1546 STRESS_NOTREACHED(); | 1546 STRESS_NOTREACHED(); |
1547 return ERR_INVALID_ADDRESS; | 1547 return ERR_INVALID_ADDRESS; |
1548 } | 1548 } |
1549 | 1549 |
1550 scoped_refptr<EntryImpl> cache_entry( | 1550 scoped_refptr<EntryImpl> cache_entry( |
1551 new EntryImpl(this, address, read_only_)); | 1551 new EntryImpl(this, address, read_only_)); |
1552 IncreaseNumRefs(); | 1552 IncreaseNumRefs(); |
1553 *entry = NULL; | 1553 *entry = NULL; |
1554 | 1554 |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2110 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2111 total_memory = kMaxBuffersSize; | 2111 total_memory = kMaxBuffersSize; |
2112 | 2112 |
2113 done = true; | 2113 done = true; |
2114 } | 2114 } |
2115 | 2115 |
2116 return static_cast<int>(total_memory); | 2116 return static_cast<int>(total_memory); |
2117 } | 2117 } |
2118 | 2118 |
2119 } // namespace disk_cache | 2119 } // namespace disk_cache |
OLD | NEW |