| 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> |
| 8 |
| 9 #include <limits> |
| 10 |
| 7 #include "net/disk_cache/blockfile/backend_impl.h" | 11 #include "net/disk_cache/blockfile/backend_impl.h" |
| 8 #include "net/disk_cache/blockfile/disk_format.h" | 12 #include "net/disk_cache/blockfile/disk_format.h" |
| 9 #include "net/disk_cache/blockfile/entry_impl.h" | 13 #include "net/disk_cache/blockfile/entry_impl.h" |
| 10 #include "net/disk_cache/blockfile/errors.h" | 14 #include "net/disk_cache/blockfile/errors.h" |
| 11 #include "net/disk_cache/blockfile/histogram_macros.h" | 15 #include "net/disk_cache/blockfile/histogram_macros.h" |
| 12 #include "net/disk_cache/blockfile/stress_support.h" | 16 #include "net/disk_cache/blockfile/stress_support.h" |
| 13 | 17 |
| 14 // Provide a BackendImpl object to macros from histogram_macros.h. | 18 // Provide a BackendImpl object to macros from histogram_macros.h. |
| 15 #define CACHE_UMA_BACKEND_IMPL_OBJ backend_ | 19 #define CACHE_UMA_BACKEND_IMPL_OBJ backend_ |
| 16 | 20 |
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 ++it) { | 904 ++it) { |
| 901 if (it->first == address) | 905 if (it->first == address) |
| 902 it->second->Discard(); | 906 it->second->Discard(); |
| 903 } | 907 } |
| 904 } | 908 } |
| 905 | 909 |
| 906 void Rankings::IncrementCounter(List list) { | 910 void Rankings::IncrementCounter(List list) { |
| 907 if (!count_lists_) | 911 if (!count_lists_) |
| 908 return; | 912 return; |
| 909 | 913 |
| 910 DCHECK(control_data_->sizes[list] < kint32max); | 914 DCHECK(control_data_->sizes[list] < std::numeric_limits<int32_t>::max()); |
| 911 if (control_data_->sizes[list] < kint32max) | 915 if (control_data_->sizes[list] < std::numeric_limits<int32_t>::max()) |
| 912 control_data_->sizes[list]++; | 916 control_data_->sizes[list]++; |
| 913 } | 917 } |
| 914 | 918 |
| 915 void Rankings::DecrementCounter(List list) { | 919 void Rankings::DecrementCounter(List list) { |
| 916 if (!count_lists_) | 920 if (!count_lists_) |
| 917 return; | 921 return; |
| 918 | 922 |
| 919 DCHECK(control_data_->sizes[list] > 0); | 923 DCHECK(control_data_->sizes[list] > 0); |
| 920 if (control_data_->sizes[list] > 0) | 924 if (control_data_->sizes[list] > 0) |
| 921 control_data_->sizes[list]--; | 925 control_data_->sizes[list]--; |
| 922 } | 926 } |
| 923 | 927 |
| 924 } // namespace disk_cache | 928 } // namespace disk_cache |
| OLD | NEW |