diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 01:30:53 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-14 01:30:53 +0000 |
commit | 7d7ad6e4439730c800ed8de654378683f587ee3a (patch) | |
tree | 8912f0d50a86565e62623c1a806c3869f90be90a /net/disk_cache | |
parent | 56ee3109efdf0eae868fc75fc52c64a226d40579 (diff) | |
download | chromium_src-7d7ad6e4439730c800ed8de654378683f587ee3a.zip chromium_src-7d7ad6e4439730c800ed8de654378683f587ee3a.tar.gz chromium_src-7d7ad6e4439730c800ed8de654378683f587ee3a.tar.bz2 |
Http Cache: Use asynchronous Open/Create/Doom entry calls.
More changes to the state machine: now we really issue
asynchronous calls when getting new cache entries. We have
to add a new serialization mechanism to the http cache in
order to handle races among multiple requests creating and
opening the same entry.
BUG=26729
TEST=unittests
Review URL: http://codereview.chromium.org/523019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36211 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 8 | ||||
-rw-r--r-- | net/disk_cache/backend_impl.h | 1 | ||||
-rw-r--r-- | net/disk_cache/disk_cache.h | 7 | ||||
-rw-r--r-- | net/disk_cache/mem_backend_impl.cc | 8 | ||||
-rw-r--r-- | net/disk_cache/mem_backend_impl.h | 1 |
5 files changed, 25 insertions, 0 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 9ab3271..3b3ca6a 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -494,6 +494,14 @@ bool BackendImpl::DoomEntry(const std::string& key) { return true; } +int BackendImpl::DoomEntry(const std::string& key, + CompletionCallback* callback) { + if (DoomEntry(key)) + return net::OK; + + return net::ERR_FAILED; +} + bool BackendImpl::DoomAllEntries() { if (!num_refs_) { PrepareForRestart(); diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index b9a288f..6267fac 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -68,6 +68,7 @@ class BackendImpl : public Backend { virtual int CreateEntry(const std::string& key, Entry** entry, CompletionCallback* callback); virtual bool DoomEntry(const std::string& key); + virtual int DoomEntry(const std::string& key, CompletionCallback* callback); virtual bool DoomAllEntries(); virtual int DoomAllEntries(CompletionCallback* callback); virtual bool DoomEntriesBetween(const base::Time initial_time, diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h index c47bd47..3d2793b 100644 --- a/net/disk_cache/disk_cache.h +++ b/net/disk_cache/disk_cache.h @@ -113,8 +113,15 @@ class Backend { CompletionCallback* callback) = 0; // Marks the entry, specified by the given key, for deletion. + // Note: This method is deprecated. virtual bool DoomEntry(const std::string& key) = 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, + CompletionCallback* callback) = 0; + // Marks all entries for deletion. // Note: This method is deprecated. virtual bool DoomAllEntries() = 0; diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc index 0b0d7bd..875efdc 100644 --- a/net/disk_cache/mem_backend_impl.cc +++ b/net/disk_cache/mem_backend_impl.cc @@ -144,6 +144,14 @@ bool MemBackendImpl::DoomEntry(const std::string& key) { return true; } +int MemBackendImpl::DoomEntry(const std::string& key, + CompletionCallback* callback) { + if (DoomEntry(key)) + return net::OK; + + return net::ERR_FAILED; +} + void MemBackendImpl::InternalDoomEntry(MemEntryImpl* entry) { // Only parent entries can be passed into this method. DCHECK(entry->type() == MemEntryImpl::kParentEntry); diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h index 5c9899e..48d196c 100644 --- a/net/disk_cache/mem_backend_impl.h +++ b/net/disk_cache/mem_backend_impl.h @@ -35,6 +35,7 @@ class MemBackendImpl : public Backend { virtual int CreateEntry(const std::string& key, Entry** entry, CompletionCallback* callback); virtual bool DoomEntry(const std::string& key); + virtual int DoomEntry(const std::string& key, CompletionCallback* callback); virtual bool DoomAllEntries(); virtual int DoomAllEntries(CompletionCallback* callback); virtual bool DoomEntriesBetween(const base::Time initial_time, |