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/backend_impl.h" | 5 #include "net/disk_cache/blockfile/backend_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 670 } |
671 | 671 |
672 EntryImpl* next_entry; | 672 EntryImpl* next_entry; |
673 next_entry = entries[newest].get(); | 673 next_entry = entries[newest].get(); |
674 iterator->list = static_cast<Rankings::List>(newest); | 674 iterator->list = static_cast<Rankings::List>(newest); |
675 next_entry->AddRef(); | 675 next_entry->AddRef(); |
676 return next_entry; | 676 return next_entry; |
677 } | 677 } |
678 | 678 |
679 bool BackendImpl::SetMaxSize(int max_bytes) { | 679 bool BackendImpl::SetMaxSize(int max_bytes) { |
680 COMPILE_ASSERT(sizeof(max_bytes) == sizeof(max_size_), unsupported_int_model); | 680 static_assert(sizeof(max_bytes) == sizeof(max_size_), |
| 681 "unsupported int model"); |
681 if (max_bytes < 0) | 682 if (max_bytes < 0) |
682 return false; | 683 return false; |
683 | 684 |
684 // Zero size means use the default. | 685 // Zero size means use the default. |
685 if (!max_bytes) | 686 if (!max_bytes) |
686 return true; | 687 return true; |
687 | 688 |
688 // Avoid a DCHECK later on. | 689 // Avoid a DCHECK later on. |
689 if (max_bytes >= kint32max - kint32max / 10) | 690 if (max_bytes >= kint32max - kint32max / 10) |
690 max_bytes = kint32max - kint32max / 10 - 1; | 691 max_bytes = kint32max - kint32max / 10 - 1; |
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2085 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2085 total_memory = kMaxBuffersSize; | 2086 total_memory = kMaxBuffersSize; |
2086 | 2087 |
2087 done = true; | 2088 done = true; |
2088 } | 2089 } |
2089 | 2090 |
2090 return static_cast<int>(total_memory); | 2091 return static_cast<int>(total_memory); |
2091 } | 2092 } |
2092 | 2093 |
2093 } // namespace disk_cache | 2094 } // namespace disk_cache |
OLD | NEW |