| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 
| 7 | 7 | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 | 9 | 
| 10 #include <string> | 10 #include <string> | 
|  | 11 #include <unordered_map> | 
| 11 #include <utility> | 12 #include <utility> | 
| 12 #include <vector> | 13 #include <vector> | 
| 13 | 14 | 
| 14 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" | 
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" | 
| 16 #include "base/containers/hash_tables.h" |  | 
| 17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" | 
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" | 
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" | 
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" | 
| 21 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" | 
| 22 #include "base/task_runner.h" | 22 #include "base/task_runner.h" | 
| 23 #include "base/time/time.h" | 23 #include "base/time/time.h" | 
| 24 #include "net/base/cache_type.h" | 24 #include "net/base/cache_type.h" | 
| 25 #include "net/disk_cache/disk_cache.h" | 25 #include "net/disk_cache/disk_cache.h" | 
| 26 #include "net/disk_cache/simple/simple_entry_impl.h" | 26 #include "net/disk_cache/simple/simple_entry_impl.h" | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 109                        const CompletionCallback& callback) override; | 109                        const CompletionCallback& callback) override; | 
| 110   int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; | 110   int CalculateSizeOfAllEntries(const CompletionCallback& callback) override; | 
| 111   scoped_ptr<Iterator> CreateIterator() override; | 111   scoped_ptr<Iterator> CreateIterator() override; | 
| 112   void GetStats(base::StringPairs* stats) override; | 112   void GetStats(base::StringPairs* stats) override; | 
| 113   void OnExternalCacheHit(const std::string& key) override; | 113   void OnExternalCacheHit(const std::string& key) override; | 
| 114 | 114 | 
| 115  private: | 115  private: | 
| 116   class SimpleIterator; | 116   class SimpleIterator; | 
| 117   friend class SimpleIterator; | 117   friend class SimpleIterator; | 
| 118 | 118 | 
| 119   typedef base::hash_map<uint64_t, SimpleEntryImpl*> EntryMap; | 119   using EntryMap = std::unordered_map<uint64_t, SimpleEntryImpl*>; | 
| 120 | 120 | 
| 121   typedef base::Callback<void(base::Time mtime, uint64_t max_size, int result)> | 121   using InitializeIndexCallback = | 
| 122       InitializeIndexCallback; | 122       base::Callback<void(base::Time mtime, uint64_t max_size, int result)>; | 
| 123 | 123 | 
| 124   class ActiveEntryProxy; | 124   class ActiveEntryProxy; | 
| 125   friend class ActiveEntryProxy; | 125   friend class ActiveEntryProxy; | 
| 126 | 126 | 
| 127   // Return value of InitCacheStructureOnDisk(). | 127   // Return value of InitCacheStructureOnDisk(). | 
| 128   struct DiskStatResult { | 128   struct DiskStatResult { | 
| 129     base::Time cache_dir_mtime; | 129     base::Time cache_dir_mtime; | 
| 130     uint64_t max_size; | 130     uint64_t max_size; | 
| 131     bool detected_magic_number_mismatch; | 131     bool detected_magic_number_mismatch; | 
| 132     int net_error; | 132     int net_error; | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 203 | 203 | 
| 204   int orig_max_size_; | 204   int orig_max_size_; | 
| 205   const SimpleEntryImpl::OperationsMode entry_operations_mode_; | 205   const SimpleEntryImpl::OperationsMode entry_operations_mode_; | 
| 206 | 206 | 
| 207   EntryMap active_entries_; | 207   EntryMap active_entries_; | 
| 208 | 208 | 
| 209   // The set of all entries which are currently being doomed. To avoid races, | 209   // The set of all entries which are currently being doomed. To avoid races, | 
| 210   // these entries cannot have Doom/Create/Open operations run until the doom | 210   // these entries cannot have Doom/Create/Open operations run until the doom | 
| 211   // is complete. The base::Closure map target is used to store deferred | 211   // is complete. The base::Closure map target is used to store deferred | 
| 212   // operations to be run at the completion of the Doom. | 212   // operations to be run at the completion of the Doom. | 
| 213   base::hash_map<uint64_t, std::vector<base::Closure>> entries_pending_doom_; | 213   std::unordered_map<uint64_t, std::vector<base::Closure>> | 
|  | 214       entries_pending_doom_; | 
| 214 | 215 | 
| 215   net::NetLog* const net_log_; | 216   net::NetLog* const net_log_; | 
| 216 }; | 217 }; | 
| 217 | 218 | 
| 218 }  // namespace disk_cache | 219 }  // namespace disk_cache | 
| 219 | 220 | 
| 220 #endif  // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 221 #endif  // NET_DISK_CACHE_SIMPLE_SIMPLE_BACKEND_IMPL_H_ | 
| OLD | NEW | 
|---|