| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 of the cache. | 5 // See net/disk_cache/disk_cache.h for the public interface of the cache. |
| 6 | 6 |
| 7 #ifndef NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ | 7 #ifndef NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ |
| 8 #define NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ | 8 #define NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
| 12 | 12 |
| 13 #include "net/disk_cache/disk_cache.h" | 13 #include "net/disk_cache/disk_cache.h" |
| 14 #include "net/disk_cache/mem_rankings.h" | 14 #include "net/disk_cache/mem_rankings.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class NetLog; | 17 class NetLog; |
| 18 } // namespace net | 18 } // namespace net |
| 19 | 19 |
| 20 namespace disk_cache { | 20 namespace disk_cache { |
| 21 | 21 |
| 22 class MemEntryImpl; | 22 class MemEntryImpl; |
| 23 | 23 |
| 24 // This class implements the Backend interface. An object of this class handles | 24 // This class implements the Backend interface. An object of this class handles |
| 25 // the operations of the cache without writing to disk. | 25 // the operations of the cache without writing to disk. |
| 26 class NET_TEST MemBackendImpl : public Backend { | 26 class NET_TEST MemBackendImpl : public Backend { |
| 27 public: | 27 public: |
| 28 explicit MemBackendImpl(net::NetLog* net_log); | 28 explicit MemBackendImpl(net::NetLog* net_log); |
| 29 ~MemBackendImpl(); | 29 virtual ~MemBackendImpl(); |
| 30 | 30 |
| 31 // Returns an instance of a Backend implemented only in memory. The returned | 31 // Returns an instance of a Backend implemented only in memory. The returned |
| 32 // object should be deleted when not needed anymore. max_bytes is the maximum | 32 // object should be deleted when not needed anymore. max_bytes is the maximum |
| 33 // size the cache can grow to. If zero is passed in as max_bytes, the cache | 33 // size the cache can grow to. If zero is passed in as max_bytes, the cache |
| 34 // will determine the value to use based on the available memory. The returned | 34 // will determine the value to use based on the available memory. The returned |
| 35 // pointer can be NULL if a fatal error is found. | 35 // pointer can be NULL if a fatal error is found. |
| 36 static Backend* CreateBackend(int max_bytes, net::NetLog* net_log); | 36 static Backend* CreateBackend(int max_bytes, net::NetLog* net_log); |
| 37 | 37 |
| 38 // Performs general initialization for this current instance of the cache. | 38 // Performs general initialization for this current instance of the cache. |
| 39 bool Init(); | 39 bool Init(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 int32 current_size_; | 109 int32 current_size_; |
| 110 | 110 |
| 111 net::NetLog* net_log_; | 111 net::NetLog* net_log_; |
| 112 | 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); | 113 DISALLOW_COPY_AND_ASSIGN(MemBackendImpl); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 } // namespace disk_cache | 116 } // namespace disk_cache |
| 117 | 117 |
| 118 #endif // NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ | 118 #endif // NET_DISK_CACHE_MEM_BACKEND_IMPL_H__ |
| OLD | NEW |