| 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/entry_impl.h" | 5 #include "net/disk_cache/entry_impl.h" |
| 6 | 6 |
| 7 #include "base/hash.h" | 7 #include "base/hash.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 backend_->RemoveEntry(this); | 495 backend_->RemoveEntry(this); |
| 496 | 496 |
| 497 // Note that at this point node_ and entry_ are just two blocks of data, and | 497 // Note that at this point node_ and entry_ are just two blocks of data, and |
| 498 // even if they reference each other, nobody should be referencing them. | 498 // even if they reference each other, nobody should be referencing them. |
| 499 | 499 |
| 500 Addr address(entry_.Data()->long_key); | 500 Addr address(entry_.Data()->long_key); |
| 501 DeleteData(address, kKeyFileIndex); | 501 DeleteData(address, kKeyFileIndex); |
| 502 backend_->ModifyStorageSize(entry_.Data()->key_len, 0); | 502 backend_->ModifyStorageSize(entry_.Data()->key_len, 0); |
| 503 | 503 |
| 504 backend_->DeleteBlock(entry_.address(), true); | 504 backend_->DeleteBlock(entry_.address(), true); |
| 505 entry_.Discard(); |
| 505 | 506 |
| 506 if (!LeaveRankingsBehind()) | 507 if (!LeaveRankingsBehind()) { |
| 507 backend_->DeleteBlock(node_.address(), true); | 508 backend_->DeleteBlock(node_.address(), true); |
| 509 node_.Discard(); |
| 510 } |
| 508 } | 511 } |
| 509 | 512 |
| 510 CacheAddr EntryImpl::GetNextAddress() { | 513 CacheAddr EntryImpl::GetNextAddress() { |
| 511 return entry_.Data()->next; | 514 return entry_.Data()->next; |
| 512 } | 515 } |
| 513 | 516 |
| 514 void EntryImpl::SetNextAddress(Addr address) { | 517 void EntryImpl::SetNextAddress(Addr address) { |
| 515 DCHECK_NE(address.value(), entry_.address().value()); | 518 DCHECK_NE(address.value(), entry_.address().value()); |
| 516 entry_.Data()->next = address.value(); | 519 entry_.Data()->next = address.value(); |
| 517 bool success = entry_.Store(); | 520 bool success = entry_.Store(); |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 1540 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
| 1538 entry_.address().value(), node_.address().value()); | 1541 entry_.address().value(), node_.address().value()); |
| 1539 | 1542 |
| 1540 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 1543 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
| 1541 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 1544 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
| 1542 | 1545 |
| 1543 Trace(" doomed: %d 0x%x", doomed_, dirty); | 1546 Trace(" doomed: %d 0x%x", doomed_, dirty); |
| 1544 } | 1547 } |
| 1545 | 1548 |
| 1546 } // namespace disk_cache | 1549 } // namespace disk_cache |
| OLD | NEW |