| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Defines the public interface of the disk cache. For more details see | 5 // Defines the public interface of the disk cache. For more details see |
| 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache | 6 // http://dev.chromium.org/developers/design-documents/network-stack/disk-cache |
| 7 | 7 |
| 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ | 8 #ifndef NET_DISK_CACHE_DISK_CACHE_H_ |
| 9 #define NET_DISK_CACHE_DISK_CACHE_H_ | 9 #define NET_DISK_CACHE_DISK_CACHE_H_ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/strings/string_split.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "net/base/cache_type.h" | 19 #include "net/base/cache_type.h" |
| 19 #include "net/base/completion_callback.h" | 20 #include "net/base/completion_callback.h" |
| 20 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class FilePath; | 24 class FilePath; |
| 24 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
| 25 } | 26 } |
| 26 | 27 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // |callback| will be invoked when the operation completes. | 143 // |callback| will be invoked when the operation completes. |
| 143 // Entries with |initial_time| <= access time are deleted. | 144 // Entries with |initial_time| <= access time are deleted. |
| 144 virtual int DoomEntriesSince(base::Time initial_time, | 145 virtual int DoomEntriesSince(base::Time initial_time, |
| 145 const CompletionCallback& callback) = 0; | 146 const CompletionCallback& callback) = 0; |
| 146 | 147 |
| 147 // Returns an iterator which will enumerate all entries of the cache in an | 148 // Returns an iterator which will enumerate all entries of the cache in an |
| 148 // undefined order. | 149 // undefined order. |
| 149 virtual scoped_ptr<Iterator> CreateIterator() = 0; | 150 virtual scoped_ptr<Iterator> CreateIterator() = 0; |
| 150 | 151 |
| 151 // Return a list of cache statistics. | 152 // Return a list of cache statistics. |
| 152 virtual void GetStats( | 153 virtual void GetStats(base::StringPairs* stats) = 0; |
| 153 std::vector<std::pair<std::string, std::string> >* stats) = 0; | |
| 154 | 154 |
| 155 // Called whenever an external cache in the system reuses the resource | 155 // Called whenever an external cache in the system reuses the resource |
| 156 // referred to by |key|. | 156 // referred to by |key|. |
| 157 virtual void OnExternalCacheHit(const std::string& key) = 0; | 157 virtual void OnExternalCacheHit(const std::string& key) = 0; |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 // This interface represents an entry in the disk cache. | 160 // This interface represents an entry in the disk cache. |
| 161 class NET_EXPORT Entry { | 161 class NET_EXPORT Entry { |
| 162 public: | 162 public: |
| 163 typedef net::CompletionCallback CompletionCallback; | 163 typedef net::CompletionCallback CompletionCallback; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 entry->Close(); | 318 entry->Close(); |
| 319 } | 319 } |
| 320 }; | 320 }; |
| 321 | 321 |
| 322 // Automatically closes an entry when it goes out of scope. | 322 // Automatically closes an entry when it goes out of scope. |
| 323 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 323 typedef scoped_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
| 324 | 324 |
| 325 } // namespace disk_cache | 325 } // namespace disk_cache |
| 326 | 326 |
| 327 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 327 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
| OLD | NEW |