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

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

Issue 533293002: Delete enumerations at Simple Cache backend deletion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lint Created 6 years, 3 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
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 462a101f96147cf8dd7b99165a0c78dc96df8cc5..907ee5a6d4535cd03046014a9ee4e0b91afd9e51 100644
--- a/net/disk_cache/simple/simple_backend_impl.h
+++ b/net/disk_cache/simple/simple_backend_impl.h
@@ -13,6 +13,7 @@
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/files/file_path.h"
+#include "base/id_map.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
@@ -107,6 +108,8 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
private:
typedef base::hash_map<uint64, SimpleEntryImpl*> EntryMap;
+ typedef IDMap<std::vector<uint64>, IDMapOwnPointer> ActiveEnumerationMap;
+
typedef base::Callback<void(base::Time mtime, uint64 max_size, int result)>
InitializeIndexCallback;
@@ -121,6 +124,17 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
int net_error;
};
+ // Convert an iterator from OpenNextEntry() to the key type for
+ // ActiveEnumerationMap. Note it takes a void** argument; this is for safety;
+ // if it took a void*, that would be type compatible with a void** permitting
+ // easy calls missing the dereference.
+ static ActiveEnumerationMap::KeyType IteratorToEnumerationId(void** iter);
+
+ // Convert a key from ActiveEnumerationMap back to a void*, suitable for
+ // storing in the iterator argument to OpenNextEntry().
+ static void* EnumerationIdToIterator(
+ ActiveEnumerationMap::KeyType enumeration_id);
+
void InitializeIndex(const CompletionCallback& callback,
const DiskStatResult& result);
@@ -206,6 +220,9 @@ class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend,
EntryMap active_entries_;
+ // One entry for every enumeration in progress.
+ ActiveEnumerationMap active_enumerations_;
+
// The set of all entries which are currently being doomed. To avoid races,
// these entries cannot have Doom/Create/Open operations run until the doom
// is complete. The base::Closure map target is used to store deferred
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698