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

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

Issue 14141: Disk cache: remove the hard coded list from rankings.cc... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // If separate file: 43 // If separate file:
44 // 0000 1111 1111 1111 1111 1111 1111 1111 : file# 0 - 268,435,456 (2^28) 44 // 0000 1111 1111 1111 1111 1111 1111 1111 : file# 0 - 268,435,456 (2^28)
45 // 45 //
46 // If block file: 46 // If block file:
47 // 0000 1100 0000 0000 0000 0000 0000 0000 : reserved bits 47 // 0000 1100 0000 0000 0000 0000 0000 0000 : reserved bits
48 // 0000 0011 0000 0000 0000 0000 0000 0000 : number of contiguous blocks 1-4 48 // 0000 0011 0000 0000 0000 0000 0000 0000 : number of contiguous blocks 1-4
49 // 0000 0000 1111 1111 0000 0000 0000 0000 : file selector 0 - 255 49 // 0000 0000 1111 1111 0000 0000 0000 0000 : file selector 0 - 255
50 // 0000 0000 0000 0000 1111 1111 1111 1111 : block# 0 - 65,535 (2^16) 50 // 0000 0000 0000 0000 1111 1111 1111 1111 : block# 0 - 65,535 (2^16)
51 class Addr { 51 class Addr {
52 public: 52 public:
53 Addr() : value_(0) {}
53 explicit Addr(CacheAddr address) : value_(address) {} 54 explicit Addr(CacheAddr address) : value_(address) {}
54 Addr(FileType file_type, int max_blocks, int block_file, int index) { 55 Addr(FileType file_type, int max_blocks, int block_file, int index) {
55 value_ = ((file_type << kFileTypeOffset) & kFileTypeMask) | 56 value_ = ((file_type << kFileTypeOffset) & kFileTypeMask) |
56 (((max_blocks - 1) << kNumBlocksOffset) & kNumBlocksMask) | 57 (((max_blocks - 1) << kNumBlocksOffset) & kNumBlocksMask) |
57 ((block_file << kFileSelectorOffset) & kFileSelectorMask) | 58 ((block_file << kFileSelectorOffset) & kFileSelectorMask) |
58 (index & kStartBlockMask) | kInitializedMask; 59 (index & kStartBlockMask) | kInitializedMask;
59 } 60 }
60 61
61 CacheAddr value() const { return value_; } 62 CacheAddr value() const { return value_; }
62 void set_value(CacheAddr address) { 63 void set_value(CacheAddr address) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 static const uint32 kStartBlockMask = 0x0000FFFF; 146 static const uint32 kStartBlockMask = 0x0000FFFF;
146 static const uint32 kFileNameMask = 0x0FFFFFFF; 147 static const uint32 kFileNameMask = 0x0FFFFFFF;
147 148
148 CacheAddr value_; 149 CacheAddr value_;
149 }; 150 };
150 151
151 } // namespace disk_cache 152 } // namespace disk_cache
152 153
153 #endif // NET_DISK_CACHE_ADDR_H__ 154 #endif // NET_DISK_CACHE_ADDR_H__
154 155
OLDNEW
« no previous file with comments | « no previous file | net/disk_cache/backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698