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

Unified Diff: net/disk_cache/disk_cache.h

Issue 9702059: Disk cache: Remove all non essential synchronization from the cache destructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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/entry_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/disk_cache.h
===================================================================
--- net/disk_cache/disk_cache.h (revision 126788)
+++ net/disk_cache/disk_cache.h (working copy)
@@ -58,6 +58,8 @@
// The root interface for a disk cache instance.
class NET_EXPORT Backend {
public:
+ typedef net::CompletionCallback CompletionCallback;
gavinp 2012/03/16 17:31:35 This is a great idea! Unfortunately, all of the na
+
// If the backend is destroyed when there are operations in progress (any
// callback that has not been invoked yet), this method cancels said
// operations so the callbacks are not invoked, possibly leaving the work
@@ -76,7 +78,7 @@
// will be invoked when the entry is available. The pointer to receive the
// |entry| must remain valid until the operation completes.
virtual int OpenEntry(const std::string& key, Entry** entry,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
// Creates a new entry. Upon success, the out param holds a pointer to an
// Entry object representing the newly created disk cache entry. When the
@@ -85,18 +87,18 @@
// the |callback| will be invoked when the entry is available. The pointer to
// receive the |entry| must remain valid until the operation completes.
virtual int CreateEntry(const std::string& key, Entry** entry,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
// Marks the entry, specified by the given key, for deletion. The return value
// is a net error code. If this method returns ERR_IO_PENDING, the |callback|
// will be invoked after the entry is doomed.
virtual int DoomEntry(const std::string& key,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
// Marks all entries for deletion. The return value is a net error code. If
// this method returns ERR_IO_PENDING, the |callback| will be invoked when the
// operation completes.
- virtual int DoomAllEntries(const net::CompletionCallback& callback) = 0;
+ virtual int DoomAllEntries(const CompletionCallback& callback) = 0;
// Marks a range of entries for deletion. This supports unbounded deletes in
// either direction by using null Time values for either argument. The return
@@ -104,13 +106,13 @@
// |callback| will be invoked when the operation completes.
virtual int DoomEntriesBetween(const base::Time initial_time,
const base::Time end_time,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
// Marks all entries accessed since |initial_time| for deletion. The return
// value is a net error code. If this method returns ERR_IO_PENDING, the
// |callback| will be invoked when the operation completes.
virtual int DoomEntriesSince(const base::Time initial_time,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
// Enumerates the cache. Initialize |iter| to NULL before calling this method
// the first time. That will cause the enumeration to start at the head of
@@ -125,7 +127,7 @@
// NOTE: This method does not modify the last_used field of the entry, and
// therefore it does not impact the eviction ranking of the entry.
virtual int OpenNextEntry(void** iter, Entry** next_entry,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
// Releases iter without returning the next entry. Whenever OpenNextEntry()
// returns true, but the caller is not interested in continuing the
@@ -145,6 +147,9 @@
// This interface represents an entry in the disk cache.
class NET_EXPORT Entry {
public:
+ typedef net::CompletionCallback CompletionCallback;
+ typedef net::IOBuffer IOBuffer;
+
// Marks this cache entry for deletion.
virtual void Doom() = 0;
@@ -176,8 +181,8 @@
// been called; in other words, the caller may close this entry without
// having to wait for all the callbacks, and still rely on the cleanup
// performed from the callback code.
- virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback) = 0;
+ virtual int ReadData(int index, int offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback) = 0;
// Copies cache data from the given buffer of length |buf_len|. If
// completion_callback is null, then this call blocks until the write
@@ -192,8 +197,8 @@
// performed from the callback code.
// If truncate is true, this call will truncate the stored data at the end of
// what we are writing here.
- virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback,
+ virtual int WriteData(int index, int offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback,
bool truncate) = 0;
// Sparse entries support:
@@ -240,8 +245,8 @@
// Behaves like ReadData() except that this method is used to access sparse
// entries.
- virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback) = 0;
+ virtual int ReadSparseData(int64 offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback) = 0;
// Behaves like WriteData() except that this method is used to access sparse
// entries. |truncate| is not part of this interface because a sparse entry
@@ -249,8 +254,8 @@
// start again, or to reduce the total size of the stream data (which implies
// that the content has changed), the whole entry should be doomed and
// re-created.
- virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- const net::CompletionCallback& callback) = 0;
+ virtual int WriteSparseData(int64 offset, IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback) = 0;
// Returns information about the currently stored portion of a sparse entry.
// |offset| and |len| describe a particular range that should be scanned to
@@ -262,7 +267,7 @@
// this method returns ERR_IO_PENDING, the |callback| will be invoked when the
// operation completes, and |start| must remain valid until that point.
virtual int GetAvailableRange(int64 offset, int len, int64* start,
- const net::CompletionCallback& callback) = 0;
+ const CompletionCallback& callback) = 0;
// Returns true if this entry could be a sparse entry or false otherwise. This
// is a quick test that may return true even if the entry is not really
@@ -292,8 +297,7 @@
// Note that CancelSparseIO may have been called on another instance of this
// object that refers to the same physical disk entry.
// Note: This method is deprecated.
- virtual int ReadyForSparseIO(
- const net::CompletionCallback& completion_callback) = 0;
+ virtual int ReadyForSparseIO(const CompletionCallback& callback) = 0;
protected:
virtual ~Entry() {}
« no previous file with comments | « net/disk_cache/backend_unittest.cc ('k') | net/disk_cache/entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698