| 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 <stdint.h> | 11 #include <stdint.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "net/base/cache_type.h" | 20 #include "net/base/cache_type.h" |
| 21 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
| 22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 23 #include "net/base/net_export.h" | 23 #include "net/base/net_export.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class FilePath; | 26 class FilePath; |
| 27 class SingleThreadTaskRunner; | 27 class SingleThreadTaskRunner; |
| 28 namespace trace_event { |
| 29 class ProcessMemoryDump; |
| 30 } |
| 28 } | 31 } |
| 29 | 32 |
| 30 namespace net { | 33 namespace net { |
| 31 class IOBuffer; | 34 class IOBuffer; |
| 32 class NetLog; | 35 class NetLog; |
| 33 } | 36 } |
| 34 | 37 |
| 35 namespace disk_cache { | 38 namespace disk_cache { |
| 36 | 39 |
| 37 class Entry; | 40 class Entry; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // Returns an iterator which will enumerate all entries of the cache in an | 170 // Returns an iterator which will enumerate all entries of the cache in an |
| 168 // undefined order. | 171 // undefined order. |
| 169 virtual std::unique_ptr<Iterator> CreateIterator() = 0; | 172 virtual std::unique_ptr<Iterator> CreateIterator() = 0; |
| 170 | 173 |
| 171 // Return a list of cache statistics. | 174 // Return a list of cache statistics. |
| 172 virtual void GetStats(base::StringPairs* stats) = 0; | 175 virtual void GetStats(base::StringPairs* stats) = 0; |
| 173 | 176 |
| 174 // Called whenever an external cache in the system reuses the resource | 177 // Called whenever an external cache in the system reuses the resource |
| 175 // referred to by |key|. | 178 // referred to by |key|. |
| 176 virtual void OnExternalCacheHit(const std::string& key) = 0; | 179 virtual void OnExternalCacheHit(const std::string& key) = 0; |
| 180 |
| 181 // Dumps memory allocation stats. |parent_dump_absolute_name| is the name |
| 182 // used by the parent MemoryAllocatorDump in the memory dump hierarchy. |
| 183 virtual void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, |
| 184 const std::string& parent_absolute_name) const {} |
| 177 }; | 185 }; |
| 178 | 186 |
| 179 // This interface represents an entry in the disk cache. | 187 // This interface represents an entry in the disk cache. |
| 180 class NET_EXPORT Entry { | 188 class NET_EXPORT Entry { |
| 181 public: | 189 public: |
| 182 typedef net::CompletionCallback CompletionCallback; | 190 typedef net::CompletionCallback CompletionCallback; |
| 183 typedef net::IOBuffer IOBuffer; | 191 typedef net::IOBuffer IOBuffer; |
| 184 | 192 |
| 185 // Marks this cache entry for deletion. | 193 // Marks this cache entry for deletion. |
| 186 virtual void Doom() = 0; | 194 virtual void Doom() = 0; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 entry->Close(); | 351 entry->Close(); |
| 344 } | 352 } |
| 345 }; | 353 }; |
| 346 | 354 |
| 347 // Automatically closes an entry when it goes out of scope. | 355 // Automatically closes an entry when it goes out of scope. |
| 348 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 356 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
| 349 | 357 |
| 350 } // namespace disk_cache | 358 } // namespace disk_cache |
| 351 | 359 |
| 352 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 360 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
| OLD | NEW |