Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / net / disk_cache / memory / mem_backend_impl.h
index 5f31be5..10946c5 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/containers/hash_tables.h"
+#include "base/memory/weak_ptr.h"
 #include "net/disk_cache/disk_cache.h"
 #include "net/disk_cache/memory/mem_rankings.h"
 
@@ -76,14 +77,15 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend {
                                  const CompletionCallback& callback) OVERRIDE;
   virtual int DoomEntriesSince(base::Time initial_time,
                                const CompletionCallback& callback) OVERRIDE;
-  virtual int OpenNextEntry(void** iter, Entry** next_entry,
-                            const CompletionCallback& callback) OVERRIDE;
-  virtual void EndEnumeration(void** iter) OVERRIDE;
+  virtual scoped_ptr<Iterator> CreateIterator() OVERRIDE;
   virtual void GetStats(
       std::vector<std::pair<std::string, std::string> >* stats) OVERRIDE {}
   virtual void OnExternalCacheHit(const std::string& key) OVERRIDE;
 
  private:
+  class MemIterator;
+  friend class MemIterator;
+
   typedef base::hash_map<std::string, MemEntryImpl*> EntryMap;
 
   // Old Backend interface.
@@ -94,7 +96,6 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend {
   bool DoomEntriesBetween(const base::Time initial_time,
                           const base::Time end_time);
   bool DoomEntriesSince(const base::Time initial_time);
-  bool OpenNextEntry(void** iter, Entry** next_entry);
 
   // Deletes entries from the cache until the current size is below the limit.
   // If empty is true, the whole cache will be trimmed, regardless of being in
@@ -112,6 +113,8 @@ class NET_EXPORT_PRIVATE MemBackendImpl : public Backend {
 
   net::NetLog* net_log_;
 
+  base::WeakPtrFactory<MemBackendImpl> weak_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(MemBackendImpl);
 };