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/rankings.h" | 5 #include "net/disk_cache/rankings.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "net/disk_cache/backend_impl.h" | 8 #include "net/disk_cache/backend_impl.h" |
9 #include "net/disk_cache/entry_impl.h" | 9 #include "net/disk_cache/entry_impl.h" |
10 #include "net/disk_cache/errors.h" | 10 #include "net/disk_cache/errors.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 base::Time now = base::Time::Now(); | 182 base::Time now = base::Time::Now(); |
183 node->Data()->last_used = now.ToInternalValue(); | 183 node->Data()->last_used = now.ToInternalValue(); |
184 if (modified) | 184 if (modified) |
185 node->Data()->last_modified = now.ToInternalValue(); | 185 node->Data()->last_modified = now.ToInternalValue(); |
186 } | 186 } |
187 | 187 |
188 } // namespace | 188 } // namespace |
189 | 189 |
190 namespace disk_cache { | 190 namespace disk_cache { |
191 | 191 |
| 192 Rankings::ScopedRankingsBlock::ScopedRankingsBlock() : rankings_(NULL) {} |
| 193 |
| 194 Rankings::ScopedRankingsBlock::ScopedRankingsBlock(Rankings* rankings) |
| 195 : rankings_(rankings) {} |
| 196 |
| 197 Rankings::ScopedRankingsBlock::ScopedRankingsBlock( |
| 198 Rankings* rankings, CacheRankingsBlock* node) |
| 199 : scoped_ptr<CacheRankingsBlock>(node), rankings_(rankings) {} |
| 200 |
192 Rankings::Iterator::Iterator(Rankings* rankings) { | 201 Rankings::Iterator::Iterator(Rankings* rankings) { |
193 memset(this, 0, sizeof(Iterator)); | 202 memset(this, 0, sizeof(Iterator)); |
194 my_rankings = rankings; | 203 my_rankings = rankings; |
195 } | 204 } |
196 | 205 |
197 Rankings::Iterator::~Iterator() { | 206 Rankings::Iterator::~Iterator() { |
198 for (int i = 0; i < 3; i++) | 207 for (int i = 0; i < 3; i++) |
199 ScopedRankingsBlock(my_rankings, nodes[i]); | 208 ScopedRankingsBlock(my_rankings, nodes[i]); |
200 } | 209 } |
201 | 210 |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 void Rankings::DecrementCounter(List list) { | 1014 void Rankings::DecrementCounter(List list) { |
1006 if (!count_lists_) | 1015 if (!count_lists_) |
1007 return; | 1016 return; |
1008 | 1017 |
1009 DCHECK(control_data_->sizes[list] > 0); | 1018 DCHECK(control_data_->sizes[list] > 0); |
1010 if (control_data_->sizes[list] > 0) | 1019 if (control_data_->sizes[list] > 0) |
1011 control_data_->sizes[list]--; | 1020 control_data_->sizes[list]--; |
1012 } | 1021 } |
1013 | 1022 |
1014 } // namespace disk_cache | 1023 } // namespace disk_cache |
OLD | NEW |