| 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 return false; | 570 return false; |
| 571 | 571 |
| 572 EntryStore* stored = entry_.Data(); | 572 EntryStore* stored = entry_.Data(); |
| 573 if (!stored->rankings_node || stored->key_len <= 0) | 573 if (!stored->rankings_node || stored->key_len <= 0) |
| 574 return false; | 574 return false; |
| 575 | 575 |
| 576 if (stored->reuse_count < 0 || stored->refetch_count < 0) | 576 if (stored->reuse_count < 0 || stored->refetch_count < 0) |
| 577 return false; | 577 return false; |
| 578 | 578 |
| 579 Addr rankings_addr(stored->rankings_node); | 579 Addr rankings_addr(stored->rankings_node); |
| 580 if (!rankings_addr.is_initialized() || rankings_addr.is_separate_file() || | 580 if (!rankings_addr.SanityCheckForRankings()) |
| 581 rankings_addr.file_type() != RANKINGS || rankings_addr.num_blocks() != 1) | |
| 582 return false; | 581 return false; |
| 583 | 582 |
| 584 Addr next_addr(stored->next); | 583 Addr next_addr(stored->next); |
| 585 if (next_addr.is_initialized() && | 584 if (next_addr.is_initialized() && !next_addr.SanityCheckForEntry()) { |
| 586 (next_addr.is_separate_file() || next_addr.file_type() != BLOCK_256)) { | |
| 587 STRESS_NOTREACHED(); | 585 STRESS_NOTREACHED(); |
| 588 return false; | 586 return false; |
| 589 } | 587 } |
| 590 STRESS_DCHECK(next_addr.value() != entry_.address().value()); | 588 STRESS_DCHECK(next_addr.value() != entry_.address().value()); |
| 591 | 589 |
| 592 if (!rankings_addr.SanityCheck() || !next_addr.SanityCheck()) | |
| 593 return false; | |
| 594 | |
| 595 if (stored->state > ENTRY_DOOMED || stored->state < ENTRY_NORMAL) | 590 if (stored->state > ENTRY_DOOMED || stored->state < ENTRY_NORMAL) |
| 596 return false; | 591 return false; |
| 597 | 592 |
| 598 Addr key_addr(stored->long_key); | 593 Addr key_addr(stored->long_key); |
| 599 if ((stored->key_len <= kMaxInternalKeyLength && key_addr.is_initialized()) || | 594 if ((stored->key_len <= kMaxInternalKeyLength && key_addr.is_initialized()) || |
| 600 (stored->key_len > kMaxInternalKeyLength && !key_addr.is_initialized())) | 595 (stored->key_len > kMaxInternalKeyLength && !key_addr.is_initialized())) |
| 601 return false; | 596 return false; |
| 602 | 597 |
| 603 if (!key_addr.SanityCheck()) | 598 if (!key_addr.SanityCheck()) |
| 604 return false; | 599 return false; |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 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), |
| 1546 entry_.address().value(), node_.address().value()); | 1541 entry_.address().value(), node_.address().value()); |
| 1547 | 1542 |
| 1548 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], |
| 1549 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 1544 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
| 1550 | 1545 |
| 1551 Trace(" doomed: %d 0x%x", doomed_, dirty); | 1546 Trace(" doomed: %d 0x%x", doomed_, dirty); |
| 1552 } | 1547 } |
| 1553 | 1548 |
| 1554 } // namespace disk_cache | 1549 } // namespace disk_cache |
| OLD | NEW |