Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: net/disk_cache/backend_impl.h

Issue 14183: Disk cache: move eviction code to a separate file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/build/net.vcproj ('k') | net/disk_cache/backend_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/backend_impl.h
===================================================================
--- net/disk_cache/backend_impl.h (revision 7126)
+++ net/disk_cache/backend_impl.h (working copy)
@@ -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 @@
// 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 @@
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 @@
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 @@
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);
};
« no previous file with comments | « net/build/net.vcproj ('k') | net/disk_cache/backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698