summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/disk_cache/backend_impl.h')
-rw-r--r--net/disk_cache/backend_impl.h52
1 files changed, 30 insertions, 22 deletions
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 05e5016..74a1eaf 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -19,6 +19,10 @@
#include "net/disk_cache/stats.h"
#include "net/disk_cache/trace.h"
+namespace net {
+class NetLog;
+} // namespace net
+
namespace disk_cache {
enum BackendFlags {
@@ -38,10 +42,11 @@ enum BackendFlags {
class BackendImpl : public Backend {
friend class Eviction;
public:
- BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread);
+ BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread,
+ net::NetLog* net_log);
// mask can be used to limit the usable size of the hash table, for testing.
BackendImpl(const FilePath& path, uint32 mask,
- base::MessageLoopProxy* cache_thread);
+ base::MessageLoopProxy* cache_thread, net::NetLog* net_log);
~BackendImpl();
// Returns a new backend with the desired flags. See the declaration of
@@ -49,29 +54,12 @@ class BackendImpl : public Backend {
static int CreateBackend(const FilePath& full_path, bool force,
int max_bytes, net::CacheType type,
uint32 flags, base::MessageLoopProxy* thread,
- Backend** backend, CompletionCallback* callback);
+ net::NetLog* net_log, Backend** backend,
+ CompletionCallback* callback);
// Performs general initialization for this current instance of the cache.
int Init(CompletionCallback* callback);
- // Backend interface.
- virtual int32 GetEntryCount() const;
- virtual int OpenEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback);
- virtual int CreateEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback);
- virtual int DoomEntry(const std::string& key, CompletionCallback* callback);
- virtual int DoomAllEntries(CompletionCallback* callback);
- virtual int DoomEntriesBetween(const base::Time initial_time,
- const base::Time end_time,
- CompletionCallback* callback);
- virtual int DoomEntriesSince(const base::Time initial_time,
- CompletionCallback* callback);
- virtual int OpenNextEntry(void** iter, Entry** next_entry,
- CompletionCallback* callback);
- virtual void EndEnumeration(void** iter);
- virtual void GetStats(StatsItems* stats);
-
// Performs the actual initialization and final cleanup on destruction.
int SyncInit();
void CleanupCache();
@@ -256,6 +244,24 @@ class BackendImpl : public Backend {
// or an error code (negative value).
int SelfCheck();
+ // Backend interface.
+ virtual int32 GetEntryCount() const;
+ virtual int OpenEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback);
+ virtual int CreateEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback);
+ virtual int DoomEntry(const std::string& key, CompletionCallback* callback);
+ virtual int DoomAllEntries(CompletionCallback* callback);
+ virtual int DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ CompletionCallback* callback);
+ virtual int DoomEntriesSince(const base::Time initial_time,
+ CompletionCallback* callback);
+ virtual int OpenNextEntry(void** iter, Entry** next_entry,
+ CompletionCallback* callback);
+ virtual void EndEnumeration(void** iter);
+ virtual void GetStats(StatsItems* stats);
+
private:
typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap;
@@ -265,7 +271,7 @@ class BackendImpl : public Backend {
void AdjustMaxCacheSize(int table_len);
// Deletes the cache and starts again.
- void RestartCache();
+ void RestartCache(bool failure);
void PrepareForRestart();
// Creates a new entry object and checks to see if it is dirty. Returns zero
@@ -357,6 +363,8 @@ class BackendImpl : public Backend {
bool first_timer_; // True if the timer has not been called.
bool throttle_requests_;
+ net::NetLog* net_log_;
+
Stats stats_; // Usage statistcs.
base::RepeatingTimer<BackendImpl> timer_; // Usage timer.
base::WaitableEvent done_; // Signals the end of background work.