diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 19:47:08 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-07 19:47:08 +0000 |
commit | c4c32fd86f36a5d282424eb3a4876f0601f8f097 (patch) | |
tree | 580af26d6d69af57f7b1c63b9fbb97fc42ef1877 /net/disk_cache/backend_impl.h | |
parent | a5624da1a85ae1e2785d8534018329e5a144e1fc (diff) | |
download | chromium_src-c4c32fd86f36a5d282424eb3a4876f0601f8f097.zip chromium_src-c4c32fd86f36a5d282424eb3a4876f0601f8f097.tar.gz chromium_src-c4c32fd86f36a5d282424eb3a4876f0601f8f097.tar.bz2 |
Disk cache: Keep a map of all open entries.
We still have a few crashes when for some reason we believe
an entry is not dirty and we follow the pointer stored by
its rankings node only to crash while accessing the memory.
I have no explanation to why the dirty id matches the current
one (a page boundary issue maybe?), but having a map with all
open entries solves the issue of having to follow pointers
from disk.
BUG=15596, b/1120346
TEST=unittests
Review URL: http://codereview.chromium.org/149218
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20067 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.h')
-rw-r--r-- | net/disk_cache/backend_impl.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h index 0aae9de..84a10c1 100644 --- a/net/disk_cache/backend_impl.h +++ b/net/disk_cache/backend_impl.h @@ -7,6 +7,7 @@ #ifndef NET_DISK_CACHE_BACKEND_IMPL_H_ #define NET_DISK_CACHE_BACKEND_IMPL_H_ +#include "base/hash_tables.h" #include "base/timer.h" #include "net/disk_cache/block_files.h" #include "net/disk_cache/disk_cache.h" @@ -99,10 +100,15 @@ class BackendImpl : public Backend { void RemoveEntry(EntryImpl* entry); // This method must be called whenever an entry is released for the last time. - void CacheEntryDestroyed(); + // |address| is the cache address of the entry. + void CacheEntryDestroyed(Addr address); + + // Returns true if the data stored by the provided |rankings| points to an + // open entry, false otherwise. + bool IsOpen(CacheRankingsBlock* rankings) const; // Returns the id being used on this run of the cache. - int32 GetCurrentEntryId(); + int32 GetCurrentEntryId() const; // Returns the maximum size for a file to reside on the cache. int MaxFileSize() const; @@ -169,6 +175,8 @@ class BackendImpl : public Backend { bool OpenPrevEntry(void** iter, Entry** prev_entry); private: + typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap; + // Creates a new backing file for the cache index. bool CreateBackingStore(disk_cache::File* file); bool InitBackingStore(bool* file_created); @@ -241,6 +249,7 @@ class BackendImpl : public Backend { uint32 mask_; // Binary mask to map a hash to the hash table. int32 max_size_; // Maximum data size for this instance. Eviction eviction_; // Handler of the eviction algorithm. + EntriesMap open_entries_; // Map of open entries. int num_refs_; // Number of referenced cache entries. int max_refs_; // Max number of referenced cache entries. int num_pending_io_; // Number of pending IO operations. |