Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: net/disk_cache/addr.h

Issue 15772003: Disk Cache: Make Stats independent of the backend implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.h » ('j') | net/disk_cache/stats.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This is an internal class that handles the address of a cache record. 5 // This is an internal class that handles the address of a cache record.
6 // See net/disk_cache/disk_cache.h for the public interface of the cache. 6 // See net/disk_cache/disk_cache.h for the public interface of the cache.
7 7
8 #ifndef NET_DISK_CACHE_ADDR_H_ 8 #ifndef NET_DISK_CACHE_ADDR_H_
9 #define NET_DISK_CACHE_ADDR_H_ 9 #define NET_DISK_CACHE_ADDR_H_
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (size < 1024) 120 if (size < 1024)
121 return BLOCK_256; 121 return BLOCK_256;
122 else if (size < 4096) 122 else if (size < 4096)
123 return BLOCK_1K; 123 return BLOCK_1K;
124 else if (size <= 4096 * 4) 124 else if (size <= 4096 * 4)
125 return BLOCK_4K; 125 return BLOCK_4K;
126 else 126 else
127 return EXTERNAL; 127 return EXTERNAL;
128 } 128 }
129 129
130 static int RequiredBlocks(int size, FileType file_type) {
gavinp 2013/05/23 15:32:33 This long list of inline functions seems not in ke
rvargas (doing something else) 2013/05/23 19:39:43 They are all trivial functions and I want to hint
131 int block_size = BlockSizeForFileType(file_type);
132 return (size + block_size - 1) / block_size;
133 }
134
130 // Returns true if this address looks like a valid one. 135 // Returns true if this address looks like a valid one.
131 bool SanityCheck() const; 136 bool SanityCheck() const;
132 bool SanityCheckForEntry() const; 137 bool SanityCheckForEntry() const;
133 bool SanityCheckForRankings() const; 138 bool SanityCheckForRankings() const;
134 139
135 private: 140 private:
136 static const uint32 kInitializedMask = 0x80000000; 141 static const uint32 kInitializedMask = 0x80000000;
137 static const uint32 kFileTypeMask = 0x70000000; 142 static const uint32 kFileTypeMask = 0x70000000;
138 static const uint32 kFileTypeOffset = 28; 143 static const uint32 kFileTypeOffset = 28;
139 static const uint32 kNumBlocksMask = 0x03000000; 144 static const uint32 kNumBlocksMask = 0x03000000;
140 static const uint32 kNumBlocksOffset = 24; 145 static const uint32 kNumBlocksOffset = 24;
141 static const uint32 kFileSelectorMask = 0x00ff0000; 146 static const uint32 kFileSelectorMask = 0x00ff0000;
142 static const uint32 kFileSelectorOffset = 16; 147 static const uint32 kFileSelectorOffset = 16;
143 static const uint32 kStartBlockMask = 0x0000FFFF; 148 static const uint32 kStartBlockMask = 0x0000FFFF;
144 static const uint32 kFileNameMask = 0x0FFFFFFF; 149 static const uint32 kFileNameMask = 0x0FFFFFFF;
145 150
146 CacheAddr value_; 151 CacheAddr value_;
147 }; 152 };
148 153
149 } // namespace disk_cache 154 } // namespace disk_cache
150 155
151 #endif // NET_DISK_CACHE_ADDR_H_ 156 #endif // NET_DISK_CACHE_ADDR_H_
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.h » ('j') | net/disk_cache/stats.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698