summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.h
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-18 00:22:08 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-18 00:22:08 +0000
commitdf4825733e94311ffdefbbed6fecc93203886243 (patch)
tree5dd5fbe5a2d3163cff7752a5abf647bfcb2ffb0e /net/disk_cache/backend_impl.h
parent4364d3ed5abb7fc2788508cac79ecd8a8703289a (diff)
downloadchromium_src-df4825733e94311ffdefbbed6fecc93203886243.zip
chromium_src-df4825733e94311ffdefbbed6fecc93203886243.tar.gz
chromium_src-df4825733e94311ffdefbbed6fecc93203886243.tar.bz2
Disk cache: move eviction code to a separate file.
There should be no change in behavior with this CL. Review URL: http://codereview.chromium.org/14183 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7190 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.h')
-rw-r--r--net/disk_cache/backend_impl.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 4725fe3..89be795 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -7,10 +7,10 @@
#ifndef NET_DISK_CACHE_BACKEND_IMPL_H__
#define NET_DISK_CACHE_BACKEND_IMPL_H__
-#include "base/compiler_specific.h"
#include "base/timer.h"
#include "net/disk_cache/block_files.h"
#include "net/disk_cache/disk_cache.h"
+#include "net/disk_cache/eviction.h"
#include "net/disk_cache/rankings.h"
#include "net/disk_cache/stats.h"
#include "net/disk_cache/trace.h"
@@ -20,16 +20,15 @@ namespace disk_cache {
// This class implements the Backend interface. An object of this
// class handles the operations of the cache for a particular profile.
class BackendImpl : public Backend {
+ friend class Eviction;
public:
explicit BackendImpl(const std::wstring& path)
- : path_(path), block_files_(path), mask_(0), max_size_(0),
- init_(false), restarted_(false), unit_test_(false), read_only_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
+ : path_(path), block_files_(path), mask_(0), max_size_(0), init_(false),
+ restarted_(false), unit_test_(false), read_only_(false) {}
// mask can be used to limit the usable size of the hash table, for testing.
BackendImpl(const std::wstring& path, uint32 mask)
: path_(path), block_files_(path), mask_(mask), max_size_(0),
- init_(false), restarted_(false), unit_test_(false), read_only_(false),
- ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) {}
+ init_(false), restarted_(false), unit_test_(false), read_only_(false) {}
~BackendImpl();
// Performs general initialization for this current instance of the cache.
@@ -153,12 +152,6 @@ class BackendImpl : public Backend {
void DestroyInvalidEntry(Addr address, EntryImpl* entry);
- // Deletes entries from the cache until the current size is below the limit.
- // If empty is true, the whole cache will be trimmed, regardless of being in
- // use.
- void TrimCache(bool empty);
- void ReportTrimTimes(EntryImpl* entry);
-
// Handles the used storage count.
void AddStorageSize(int32 bytes);
void SubstractStorageSize(int32 bytes);
@@ -186,6 +179,7 @@ class BackendImpl : public Backend {
Rankings rankings_; // Rankings to be able to trim the cache.
uint32 mask_; // Binary mask to map a hash to the hash table.
int32 max_size_; // Maximum data size for this instance.
+ Eviction eviction_; // Handler of the eviction algorithm.
int num_refs_; // Number of referenced cache entries.
int max_refs_; // Max number of eferenced cache entries.
int num_pending_io_; // Number of pending IO operations;
@@ -198,7 +192,6 @@ class BackendImpl : public Backend {
Stats stats_; // Usage statistcs.
base::RepeatingTimer<BackendImpl> timer_; // Usage timer.
TraceObject trace_object_; // Inits and destroys internal tracing.
- ScopedRunnableMethodFactory<BackendImpl> factory_;
DISALLOW_EVIL_CONSTRUCTORS(BackendImpl);
};