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

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

Issue 14295013: Simple Cache: DoomEntriesBetween() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: first round of comments Created 7 years, 8 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_index.h
diff --git a/net/disk_cache/simple/simple_index.h b/net/disk_cache/simple/simple_index.h
index 44fdf1725f55d4c89a32e501d00bbadfd6c8c016..5def21b4773a9db3076b43eedeefe3f3b66861cb 100644
--- a/net/disk_cache/simple/simple_index.h
+++ b/net/disk_cache/simple/simple_index.h
@@ -5,7 +5,8 @@
#ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
#define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
-#include <map>
+#include <list>
+#include <set>
#include <string>
#include "base/basictypes.h"
@@ -16,6 +17,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "base/time.h"
+#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
class Pickle;
@@ -101,6 +103,19 @@ class NET_EXPORT_PRIVATE SimpleIndex
static void InsertInEntrySet(const EntryMetadata& entry_metadata,
EntrySet* entry_set);
+ // Executes the |callback| when the index is ready. Allows multiple callbacks.
+ int ExecuteWhenReady(const net::CompletionCallback& callback);
+
+ // Takes out entries from the index that have last accessed time matching the
+ // range between |initial_time| and |end_time| where open intervals are
+ // possible according to the definition given in |DoomEntriesBetween()| in the
+ // disk cache backend interface. Returns the set of hashes taken out.
+ std::set<uint64>* ExtractEntriesBetween(const base::Time initial_time,
+ const base::Time end_time);
+
+ // Returns number of indexed entries.
+ int32 GetEntryCount() const;
+
private:
typedef base::Callback<void(scoped_ptr<EntrySet>)> IndexCompletionCallback;
@@ -137,6 +152,9 @@ class NET_EXPORT_PRIVATE SimpleIndex
// All nonstatic SimpleEntryImpl methods should always be called on the IO
// thread, in all cases. |io_thread_checker_| documents and enforces this.
base::ThreadChecker io_thread_checker_;
+
+ typedef std::list<net::CompletionCallback> CallbackList;
+ CallbackList to_run_when_initialized_;
};
} // namespace disk_cache

Powered by Google App Engine
This is Rietveld 408576698