| 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/rankings.h" | 5 #include "net/disk_cache/rankings.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "net/disk_cache/backend_impl.h" | 8 #include "net/disk_cache/backend_impl.h" |
| 9 #include "net/disk_cache/disk_format.h" | 9 #include "net/disk_cache/disk_format.h" |
| 10 #include "net/disk_cache/entry_impl.h" | 10 #include "net/disk_cache/entry_impl.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 return false; | 526 return false; |
| 527 | 527 |
| 528 if ((node->address().value() == data->next) && !IsTail(data->next, &list)) | 528 if ((node->address().value() == data->next) && !IsTail(data->next, &list)) |
| 529 return false; | 529 return false; |
| 530 | 530 |
| 531 if (!data->next && !data->prev) | 531 if (!data->next && !data->prev) |
| 532 return true; | 532 return true; |
| 533 | 533 |
| 534 Addr next_addr(data->next); | 534 Addr next_addr(data->next); |
| 535 Addr prev_addr(data->prev); | 535 Addr prev_addr(data->prev); |
| 536 if (!next_addr.SanityCheck() || next_addr.file_type() != RANKINGS || | 536 if (!next_addr.SanityCheckV2() || next_addr.file_type() != RANKINGS || |
| 537 !prev_addr.SanityCheck() || prev_addr.file_type() != RANKINGS) | 537 !prev_addr.SanityCheckV2() || prev_addr.file_type() != RANKINGS) |
| 538 return false; | 538 return false; |
| 539 | 539 |
| 540 return true; | 540 return true; |
| 541 } | 541 } |
| 542 | 542 |
| 543 bool Rankings::DataSanityCheck(CacheRankingsBlock* node, bool from_list) const { | 543 bool Rankings::DataSanityCheck(CacheRankingsBlock* node, bool from_list) const { |
| 544 const RankingsNode* data = node->Data(); | 544 const RankingsNode* data = node->Data(); |
| 545 if (!data->contents) | 545 if (!data->contents) |
| 546 return false; | 546 return false; |
| 547 | 547 |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 void Rankings::DecrementCounter(List list) { | 913 void Rankings::DecrementCounter(List list) { |
| 914 if (!count_lists_) | 914 if (!count_lists_) |
| 915 return; | 915 return; |
| 916 | 916 |
| 917 DCHECK(control_data_->sizes[list] > 0); | 917 DCHECK(control_data_->sizes[list] > 0); |
| 918 if (control_data_->sizes[list] > 0) | 918 if (control_data_->sizes[list] > 0) |
| 919 control_data_->sizes[list]--; | 919 control_data_->sizes[list]--; |
| 920 } | 920 } |
| 921 | 921 |
| 922 } // namespace disk_cache | 922 } // namespace disk_cache |
| OLD | NEW |