| 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/rankings.h" | 5 #include "net/disk_cache/blockfile/rankings.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 return false; | 535 return false; |
| 536 | 536 |
| 537 if ((node->address().value() == data->next) && !IsTail(data->next, &list)) | 537 if ((node->address().value() == data->next) && !IsTail(data->next, &list)) |
| 538 return false; | 538 return false; |
| 539 | 539 |
| 540 if (!data->next && !data->prev) | 540 if (!data->next && !data->prev) |
| 541 return true; | 541 return true; |
| 542 | 542 |
| 543 Addr next_addr(data->next); | 543 Addr next_addr(data->next); |
| 544 Addr prev_addr(data->prev); | 544 Addr prev_addr(data->prev); |
| 545 if (!next_addr.SanityCheckV2() || next_addr.file_type() != RANKINGS || | 545 if (!next_addr.SanityCheck() || next_addr.file_type() != RANKINGS || |
| 546 !prev_addr.SanityCheckV2() || prev_addr.file_type() != RANKINGS) | 546 !prev_addr.SanityCheck() || prev_addr.file_type() != RANKINGS) |
| 547 return false; | 547 return false; |
| 548 | 548 |
| 549 return true; | 549 return true; |
| 550 } | 550 } |
| 551 | 551 |
| 552 bool Rankings::DataSanityCheck(CacheRankingsBlock* node, bool from_list) const { | 552 bool Rankings::DataSanityCheck(CacheRankingsBlock* node, bool from_list) const { |
| 553 const RankingsNode* data = node->Data(); | 553 const RankingsNode* data = node->Data(); |
| 554 if (!data->contents) | 554 if (!data->contents) |
| 555 return false; | 555 return false; |
| 556 | 556 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 void Rankings::DecrementCounter(List list) { | 920 void Rankings::DecrementCounter(List list) { |
| 921 if (!count_lists_) | 921 if (!count_lists_) |
| 922 return; | 922 return; |
| 923 | 923 |
| 924 DCHECK(control_data_->sizes[list] > 0); | 924 DCHECK(control_data_->sizes[list] > 0); |
| 925 if (control_data_->sizes[list] > 0) | 925 if (control_data_->sizes[list] > 0) |
| 926 control_data_->sizes[list]--; | 926 control_data_->sizes[list]--; |
| 927 } | 927 } |
| 928 | 928 |
| 929 } // namespace disk_cache | 929 } // namespace disk_cache |
| OLD | NEW |