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

Unified Diff: net/disk_cache/simple/simple_backend_impl.h

Issue 23486006: Track entries pending Doom in SimpleCache backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months 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
Index: net/disk_cache/simple/simple_backend_impl.h
diff --git a/net/disk_cache/simple/simple_backend_impl.h b/net/disk_cache/simple/simple_backend_impl.h
index 4f01351752e1bd80893966732bca1a5f5d448f15..384e5392f07bfaeb28f960baa5a74e9916847f0d 100644
--- a/net/disk_cache/simple/simple_backend_impl.h
+++ b/net/disk_cache/simple/simple_backend_impl.h
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
+#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/files/file_path.h"
@@ -64,6 +65,9 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
// operations to construct a new object.
void OnDeactivated(const SimpleEntryImpl* entry);
+ void OnDoomStart(uint64 entry_hash);
+ void OnDoomComplete(uint64 entry_hash);
+
// Backend:
virtual net::CacheType GetCacheType() const OVERRIDE;
virtual int32 GetEntryCount() const OVERRIDE;
@@ -118,6 +122,7 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
// Searches |active_entries_| for the entry corresponding to |key|. If found,
// returns the found entry. Otherwise, creates a new entry and returns that.
scoped_refptr<SimpleEntryImpl> CreateOrFindActiveEntry(
+ uint64 entry_hash,
const std::string& key);
// Given a hash, will try to open the corresponding Entry. If we have an Entry
@@ -170,10 +175,12 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
int orig_max_size_;
const SimpleEntryImpl::OperationsMode entry_operations_mode_;
- // TODO(gavinp): Store the entry_hash in SimpleEntryImpl, and index this map
- // by hash. This will save memory, and make IndexReadyForDoom easier.
EntryMap active_entries_;
+ // For each entry pending doom, stores an optional base::Closure which
+ // contains operations delayed until the doom completes.
+ base::hash_map<uint64, base::Closure> entries_pending_doom_;
+
net::NetLog* const net_log_;
};
« no previous file with comments | « no previous file | net/disk_cache/simple/simple_backend_impl.cc » ('j') | net/disk_cache/simple/simple_backend_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698