OLD | NEW |
1 // Copyright (c) 2011 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/addr.h" | 5 #include "net/disk_cache/addr.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace disk_cache { | 9 namespace disk_cache { |
10 | 10 |
11 int Addr::start_block() const { | 11 int Addr::start_block() const { |
(...skipping 21 matching lines...) Expand all Loading... |
33 if (((value_ & kFileTypeMask) >> kFileTypeOffset) > 4) | 33 if (((value_ & kFileTypeMask) >> kFileTypeOffset) > 4) |
34 return false; | 34 return false; |
35 | 35 |
36 if (is_separate_file()) | 36 if (is_separate_file()) |
37 return true; | 37 return true; |
38 | 38 |
39 const uint32 kReservedBitsMask = 0x0c000000; | 39 const uint32 kReservedBitsMask = 0x0c000000; |
40 return !(value_ & kReservedBitsMask); | 40 return !(value_ & kReservedBitsMask); |
41 } | 41 } |
42 | 42 |
| 43 bool Addr::SanityCheckForEntry() const { |
| 44 if (!SanityCheck() || !is_initialized()) |
| 45 return false; |
| 46 |
| 47 if (is_separate_file() || file_type() != BLOCK_256) |
| 48 return false; |
| 49 |
| 50 return true; |
| 51 } |
| 52 |
| 53 bool Addr::SanityCheckForRankings() const { |
| 54 if (!SanityCheck() || !is_initialized()) |
| 55 return false; |
| 56 |
| 57 if (is_separate_file() || file_type() != RANKINGS || num_blocks() != 1) |
| 58 return false; |
| 59 |
| 60 return true; |
| 61 } |
| 62 |
43 } // namespace disk_cache | 63 } // namespace disk_cache |
OLD | NEW |