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/mem_backend_impl.h" | 5 #include "net/disk_cache/mem_backend_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/disk_cache/cache_util.h" | 10 #include "net/disk_cache/cache_util.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 void MemBackendImpl::InsertIntoRankingList(MemEntryImpl* entry) { | 119 void MemBackendImpl::InsertIntoRankingList(MemEntryImpl* entry) { |
120 rankings_.Insert(entry); | 120 rankings_.Insert(entry); |
121 } | 121 } |
122 | 122 |
123 void MemBackendImpl::RemoveFromRankingList(MemEntryImpl* entry) { | 123 void MemBackendImpl::RemoveFromRankingList(MemEntryImpl* entry) { |
124 rankings_.Remove(entry); | 124 rankings_.Remove(entry); |
125 } | 125 } |
126 | 126 |
| 127 net::CacheType MemBackendImpl::GetCacheType() const { |
| 128 return net::MEMORY_CACHE; |
| 129 } |
| 130 |
127 int32 MemBackendImpl::GetEntryCount() const { | 131 int32 MemBackendImpl::GetEntryCount() const { |
128 return static_cast<int32>(entries_.size()); | 132 return static_cast<int32>(entries_.size()); |
129 } | 133 } |
130 | 134 |
131 int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, | 135 int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry, |
132 const CompletionCallback& callback) { | 136 const CompletionCallback& callback) { |
133 if (OpenEntry(key, entry)) | 137 if (OpenEntry(key, entry)) |
134 return net::OK; | 138 return net::OK; |
135 | 139 |
136 return net::ERR_FAILED; | 140 return net::ERR_FAILED; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 if (current_size_ > max_size_) | 322 if (current_size_ > max_size_) |
319 TrimCache(false); | 323 TrimCache(false); |
320 } | 324 } |
321 | 325 |
322 void MemBackendImpl::SubstractStorageSize(int32 bytes) { | 326 void MemBackendImpl::SubstractStorageSize(int32 bytes) { |
323 current_size_ -= bytes; | 327 current_size_ -= bytes; |
324 DCHECK_GE(current_size_, 0); | 328 DCHECK_GE(current_size_, 0); |
325 } | 329 } |
326 | 330 |
327 } // namespace disk_cache | 331 } // namespace disk_cache |
OLD | NEW |