OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // See net/disk_cache/disk_cache.h for the public interface. | 5 // See net/disk_cache/disk_cache.h for the public interface. |
6 | 6 |
7 #ifndef NET_DISK_CACHE_RANKINGS_H_ | 7 #ifndef NET_DISK_CACHE_RANKINGS_H_ |
8 #define NET_DISK_CACHE_RANKINGS_H_ | 8 #define NET_DISK_CACHE_RANKINGS_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 | 11 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // scoped_ptr::reset will delete the object. | 80 // scoped_ptr::reset will delete the object. |
81 void reset(CacheRankingsBlock* p = NULL) { | 81 void reset(CacheRankingsBlock* p = NULL) { |
82 if (p != get()) | 82 if (p != get()) |
83 rankings_->FreeRankingsBlock(get()); | 83 rankings_->FreeRankingsBlock(get()); |
84 scoped_ptr<CacheRankingsBlock>::reset(p); | 84 scoped_ptr<CacheRankingsBlock>::reset(p); |
85 } | 85 } |
86 | 86 |
87 private: | 87 private: |
88 Rankings* rankings_; | 88 Rankings* rankings_; |
89 DISALLOW_EVIL_CONSTRUCTORS(ScopedRankingsBlock); | 89 DISALLOW_COPY_AND_ASSIGN(ScopedRankingsBlock); |
90 }; | 90 }; |
91 | 91 |
92 // If we have multiple lists, we have to iterate through all at the same time. | 92 // If we have multiple lists, we have to iterate through all at the same time. |
93 // This structure keeps track of where we are on the iteration. | 93 // This structure keeps track of where we are on the iteration. |
94 struct Iterator { | 94 struct Iterator { |
95 List list; // Which entry was returned to the user. | 95 List list; // Which entry was returned to the user. |
96 CacheRankingsBlock* nodes[3]; // Nodes on the first three lists. | 96 CacheRankingsBlock* nodes[3]; // Nodes on the first three lists. |
97 Rankings* my_rankings; | 97 Rankings* my_rankings; |
98 explicit Iterator(Rankings* rankings) { | 98 explicit Iterator(Rankings* rankings) { |
99 memset(this, 0, sizeof(Iterator)); | 99 memset(this, 0, sizeof(Iterator)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 BackendImpl* backend_; | 196 BackendImpl* backend_; |
197 LruData* control_data_; // Data related to the LRU lists. | 197 LruData* control_data_; // Data related to the LRU lists. |
198 IteratorList iterators_; | 198 IteratorList iterators_; |
199 | 199 |
200 DISALLOW_COPY_AND_ASSIGN(Rankings); | 200 DISALLOW_COPY_AND_ASSIGN(Rankings); |
201 }; | 201 }; |
202 | 202 |
203 } // namespace disk_cache | 203 } // namespace disk_cache |
204 | 204 |
205 #endif // NET_DISK_CACHE_RANKINGS_H_ | 205 #endif // NET_DISK_CACHE_RANKINGS_H_ |
OLD | NEW |