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/entry_impl.h" | 9 #include "net/disk_cache/entry_impl.h" |
10 #include "net/disk_cache/errors.h" | 10 #include "net/disk_cache/errors.h" |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 return ERR_INVALID_TAIL; | 899 return ERR_INVALID_TAIL; |
900 } | 900 } |
901 } while (current != end1 && current != end2); | 901 } while (current != end1 && current != end2); |
902 return ERR_NO_ERROR; | 902 return ERR_NO_ERROR; |
903 } | 903 } |
904 | 904 |
905 // TODO(rvargas): remove when we figure why we have corrupt heads. | 905 // TODO(rvargas): remove when we figure why we have corrupt heads. |
906 void Rankings::QuickListCheck() { | 906 void Rankings::QuickListCheck() { |
907 for (int i = 0; i < LAST_ELEMENT; i++) { | 907 for (int i = 0; i < LAST_ELEMENT; i++) { |
908 int rv = CheckHeadAndTail(static_cast<List>(i)); | 908 int rv = CheckHeadAndTail(static_cast<List>(i)); |
909 CACHE_UMA(CACHE_ERROR, "QuickListCheck", 0, rv); | 909 CACHE_UMA(CACHE_ERROR, "QuickListCheck", 0, rv * -1); |
910 } | 910 } |
911 } | 911 } |
912 | 912 |
913 int Rankings::CheckHeadAndTail(List list) { | 913 int Rankings::CheckHeadAndTail(List list) { |
914 Addr head_addr = heads_[list]; | 914 Addr head_addr = heads_[list]; |
915 Addr tail_addr = tails_[list]; | 915 Addr tail_addr = tails_[list]; |
916 | 916 |
917 if (!head_addr.is_initialized() && !tail_addr.is_initialized()) | 917 if (!head_addr.is_initialized() && !tail_addr.is_initialized()) |
918 return ERR_NO_ERROR; | 918 return ERR_NO_ERROR; |
919 | 919 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 void Rankings::DecrementCounter(List list) { | 1005 void Rankings::DecrementCounter(List list) { |
1006 if (!count_lists_) | 1006 if (!count_lists_) |
1007 return; | 1007 return; |
1008 | 1008 |
1009 DCHECK(control_data_->sizes[list] > 0); | 1009 DCHECK(control_data_->sizes[list] > 0); |
1010 if (control_data_->sizes[list] > 0) | 1010 if (control_data_->sizes[list] > 0) |
1011 control_data_->sizes[list]--; | 1011 control_data_->sizes[list]--; |
1012 } | 1012 } |
1013 | 1013 |
1014 } // namespace disk_cache | 1014 } // namespace disk_cache |
OLD | NEW |