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/blockfile/backend_impl.h" | 5 #include "net/disk_cache/blockfile/backend_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1243 return net::ERR_IO_PENDING; | 1243 return net::ERR_IO_PENDING; |
1244 } | 1244 } |
1245 | 1245 |
1246 int BackendImpl::DoomEntriesSince(const base::Time initial_time, | 1246 int BackendImpl::DoomEntriesSince(const base::Time initial_time, |
1247 const CompletionCallback& callback) { | 1247 const CompletionCallback& callback) { |
1248 DCHECK(!callback.is_null()); | 1248 DCHECK(!callback.is_null()); |
1249 background_queue_.DoomEntriesSince(initial_time, callback); | 1249 background_queue_.DoomEntriesSince(initial_time, callback); |
1250 return net::ERR_IO_PENDING; | 1250 return net::ERR_IO_PENDING; |
1251 } | 1251 } |
1252 | 1252 |
1253 int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry, | |
1254 const CompletionCallback& callback) { | |
1255 DCHECK(!callback.is_null()); | |
1256 background_queue_.OpenNextEntry(iter, next_entry, callback); | |
1257 return net::ERR_IO_PENDING; | |
1258 } | |
1259 | 1253 |
1260 void BackendImpl::EndEnumeration(void** iter) { | 1254 scoped_ptr<Backend::Iterator> BackendImpl::CreateIterator() { |
1261 background_queue_.EndEnumeration(*iter); | 1255 class BackendIterator FINAL : public Backend::Iterator { |
rvargas (doing something else)
2014/09/18 02:32:11
declare this outside the method
rvargas (doing something else)
2014/09/18 02:32:12
Is there any real value to annotate this class wit
gavinp
2014/09/18 18:13:04
Done.
gavinp
2014/09/18 18:13:04
No. Removed.
| |
1262 *iter = NULL; | 1256 public: |
1257 explicit BackendIterator(base::WeakPtr<InFlightBackendIO> background_queue) | |
1258 : background_queue_(background_queue), data_(NULL) {} | |
1259 | |
1260 virtual int OpenNextEntry( | |
1261 Entry** next_entry, | |
1262 const net::CompletionCallback& callback) OVERRIDE { | |
1263 if (!background_queue_) | |
1264 return net::ERR_FAILED; | |
1265 background_queue_->OpenNextEntry(&data_, next_entry, callback); | |
1266 return net::ERR_IO_PENDING; | |
1267 } | |
1268 | |
1269 private: | |
1270 const base::WeakPtr<InFlightBackendIO> background_queue_; | |
1271 void* data_; | |
1272 }; | |
1273 | |
1274 return | |
1275 scoped_ptr<Backend::Iterator>(new BackendIterator(GetBackgroundQueue())); | |
1263 } | 1276 } |
1264 | 1277 |
1265 void BackendImpl::GetStats(StatsItems* stats) { | 1278 void BackendImpl::GetStats(StatsItems* stats) { |
1266 if (disabled_) | 1279 if (disabled_) |
1267 return; | 1280 return; |
1268 | 1281 |
1269 std::pair<std::string, std::string> item; | 1282 std::pair<std::string, std::string> item; |
1270 | 1283 |
1271 item.first = "Entries"; | 1284 item.first = "Entries"; |
1272 item.second = base::StringPrintf("%d", data_->header.num_entries); | 1285 item.second = base::StringPrintf("%d", data_->header.num_entries); |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2066 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2079 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2067 total_memory = kMaxBuffersSize; | 2080 total_memory = kMaxBuffersSize; |
2068 | 2081 |
2069 done = true; | 2082 done = true; |
2070 } | 2083 } |
2071 | 2084 |
2072 return static_cast<int>(total_memory); | 2085 return static_cast<int>(total_memory); |
2073 } | 2086 } |
2074 | 2087 |
2075 } // namespace disk_cache | 2088 } // namespace disk_cache |
OLD | NEW |