12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <string> 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <utility> 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <vector> 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include "base/callback_forward.h" 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/compiler_specific.h" 147d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "base/containers/hash_tables.h" 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/files/file_path.h" 16c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/memory/ref_counted.h" 17c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/memory/scoped_ptr.h" 18c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/memory/weak_ptr.h" 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/task_runner.h" 20bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch#include "base/time/time.h" 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/base/cache_type.h" 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "net/disk_cache/disk_cache.h" 23bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch#include "net/disk_cache/simple/simple_entry_impl.h" 2468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#include "net/disk_cache/simple/simple_index_delegate.h" 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 26c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)namespace base { 27c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class SingleThreadTaskRunner; 287d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)class TaskRunner; 29c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)} 30c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace disk_cache { 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// SimpleBackendImpl is a new cache backend that stores entries in individual 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// files. 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// See http://www.chromium.org/developers/design-documents/network-stack/disk-cache/very-simple-backend 36a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// 371320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// The SimpleBackendImpl provides safe iteration; mutating entries during 381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// iteration cannot cause a crash. It is undefined whether entries created or 391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// destroyed during the iteration will be included in any pre-existing 401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// iterations. 411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci// 42a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// The non-static functions below must be called on the IO thread unless 43a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)// otherwise stated. 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 45c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class SimpleEntryImpl; 46c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class SimpleIndex; 47c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 48c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class NET_EXPORT_PRIVATE SimpleBackendImpl : public Backend, 4968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) public SimpleIndexDelegate, 50c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) public base::SupportsWeakPtr<SimpleBackendImpl> { 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public: 5203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) SimpleBackendImpl( 5303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) const base::FilePath& path, 5403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) int max_bytes, 5503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) net::CacheType cache_type, 5603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, 5703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) net::NetLog* net_log); 58c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual ~SimpleBackendImpl(); 602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 6168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) net::CacheType cache_type() const { return cache_type_; } 62c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) SimpleIndex* index() { return index_.get(); } 63c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 647d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) base::TaskRunner* worker_pool() { return worker_pool_.get(); } 657d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 66c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) int Init(const CompletionCallback& completion_callback); 67c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 68c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Sets the maximum size for the total amount of data stored by this instance. 69c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) bool SetMaxSize(int max_bytes); 70c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 71b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // Returns the maximum file size permitted in this backend. 72b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) int GetMaxFileSize() const; 73b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 7458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // Flush our SequencedWorkerPool. 7558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) static void FlushWorkerPoolForTesting(); 7658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 7758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // The entry for |entry_hash| is being doomed; the backend will not attempt 7858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // run new operations for this |entry_hash| until the Doom is completed. 7958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void OnDoomStart(uint64 entry_hash); 8058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 8158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // The entry for |entry_hash| has been successfully doomed, we can now allow 8258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // operations on this entry, and we can run any operations enqueued while the 8358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // doom completed. 8458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) void OnDoomComplete(uint64 entry_hash); 8558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 8668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // SimpleIndexDelegate: 8768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) virtual void DoomEntries(std::vector<uint64>* entry_hashes, 8868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) const CompletionCallback& callback) OVERRIDE; 8968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 90a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) // Backend: 912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual net::CacheType GetCacheType() const OVERRIDE; 922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual int32 GetEntryCount() const OVERRIDE; 932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual int OpenEntry(const std::string& key, Entry** entry, 942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const CompletionCallback& callback) OVERRIDE; 952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual int CreateEntry(const std::string& key, Entry** entry, 962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const CompletionCallback& callback) OVERRIDE; 972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual int DoomEntry(const std::string& key, 982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const CompletionCallback& callback) OVERRIDE; 992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual int DoomAllEntries(const CompletionCallback& callback) OVERRIDE; 1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual int DoomEntriesBetween(base::Time initial_time, 1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) base::Time end_time, 1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const CompletionCallback& callback) OVERRIDE; 1032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual int DoomEntriesSince(base::Time initial_time, 1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const CompletionCallback& callback) OVERRIDE; 1051320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE; 1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void GetStats( 1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE; 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void OnExternalCacheHit(const std::string& key) OVERRIDE; 1092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private: 1111320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci class SimpleIterator; 1121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci friend class SimpleIterator; 1131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 1141320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci typedef base::hash_map<uint64, SimpleEntryImpl*> EntryMap; 115c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 116bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch typedef base::Callback<void(base::Time mtime, uint64 max_size, int result)> 117c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) InitializeIndexCallback; 118c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 1191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci class ActiveEntryProxy; 1201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci friend class ActiveEntryProxy; 1211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci 122a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) // Return value of InitCacheStructureOnDisk(). 123a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) struct DiskStatResult { 124a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) base::Time cache_dir_mtime; 125a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) uint64 max_size; 126a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) bool detected_magic_number_mismatch; 127a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) int net_error; 128a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) }; 129a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 130a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) void InitializeIndex(const CompletionCallback& callback, 131a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) const DiskStatResult& result); 132c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 133c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Dooms all entries previously accessed between |initial_time| and 134c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // |end_time|. Invoked when the index is ready. 135c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) void IndexReadyForDoom(base::Time initial_time, 136c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) base::Time end_time, 137c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const CompletionCallback& callback, 138c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) int result); 139c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 140a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) // Try to create the directory if it doesn't exist. This must run on the IO 141a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) // thread. 142a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) static DiskStatResult InitCacheStructureOnDisk(const base::FilePath& path, 143a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) uint64 suggested_max_size); 1442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 145c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // Searches |active_entries_| for the entry corresponding to |key|. If found, 146c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // returns the found entry. Otherwise, creates a new entry and returns that. 147c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) scoped_refptr<SimpleEntryImpl> CreateOrFindActiveEntry( 14858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) uint64 entry_hash, 149c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const std::string& key); 1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 151eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // Given a hash, will try to open the corresponding Entry. If we have an Entry 152eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // corresponding to |hash| in the map of active entries, opens it. Otherwise, 153eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // a new empty Entry will be created, opened and filled with information from 154eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // the disk. 15568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) int OpenEntryFromHash(uint64 entry_hash, 156eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch Entry** entry, 157eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const CompletionCallback& callback); 158eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 15968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // Doom the entry corresponding to |entry_hash|, if it's active or currently 16068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // pending doom. This function does not block if there is an active entry, 16168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // which is very important to prevent races in DoomEntries() above. 16268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) int DoomEntryFromHash(uint64 entry_hash, const CompletionCallback & callback); 16368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 164eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // Called when we tried to open an entry with hash alone. When a blank entry 165eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // has been created and filled in with information from the disk - based on a 166eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // hash alone - this checks that a duplicate active entry was not created 167eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // using a key in the meantime. 168eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch void OnEntryOpenedFromHash(uint64 hash, 169eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch Entry** entry, 1701320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const scoped_refptr<SimpleEntryImpl>& simple_entry, 171eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const CompletionCallback& callback, 172eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch int error_code); 173eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 174eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // Called when we tried to open an entry from key. When the entry has been 175eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // opened, a check for key mismatch is performed. 176eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch void OnEntryOpenedFromKey(const std::string key, 177eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch Entry** entry, 1781320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const scoped_refptr<SimpleEntryImpl>& simple_entry, 179eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const CompletionCallback& callback, 180eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch int error_code); 181eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 18268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // A callback thunk used by DoomEntries to clear the |entries_pending_doom_| 18368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // after a mass doom. 18468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) void DoomEntriesComplete(scoped_ptr<std::vector<uint64> > entry_hashes, 18568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) const CompletionCallback& callback, 18668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) int result); 18768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) 1882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const base::FilePath path_; 18958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) const net::CacheType cache_type_; 190c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) scoped_ptr<SimpleIndex> index_; 191c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const scoped_refptr<base::SingleThreadTaskRunner> cache_thread_; 1927d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) scoped_refptr<base::TaskRunner> worker_pool_; 193c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 194c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) int orig_max_size_; 195bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch const SimpleEntryImpl::OperationsMode entry_operations_mode_; 196c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 197c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) EntryMap active_entries_; 1987dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 19958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // The set of all entries which are currently being doomed. To avoid races, 20058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // these entries cannot have Doom/Create/Open operations run until the doom 20158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // is complete. The base::Closure map target is used to store deferred 20258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // operations to be run at the completion of the Doom. 20358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) base::hash_map<uint64, std::vector<base::Closure> > entries_pending_doom_; 20458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 205bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch net::NetLog* const net_log_; 2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace disk_cache 2092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ 211