| 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 |
| 29 namespace trace_event { |
| 30 class ProcessMemoryDump; |
| 28 } | 31 } |
| 29 | 32 |
| 33 } // namespace base |
| 34 |
| 30 namespace net { | 35 namespace net { |
| 31 class IOBuffer; | 36 class IOBuffer; |
| 32 class NetLog; | 37 class NetLog; |
| 33 } | 38 } |
| 34 | 39 |
| 35 namespace disk_cache { | 40 namespace disk_cache { |
| 36 | 41 |
| 37 class Entry; | 42 class Entry; |
| 38 class Backend; | 43 class Backend; |
| 39 | 44 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 virtual std::unique_ptr<Iterator> CreateIterator() = 0; | 174 virtual std::unique_ptr<Iterator> CreateIterator() = 0; |
| 170 | 175 |
| 171 // Return a list of cache statistics. | 176 // Return a list of cache statistics. |
| 172 virtual void GetStats(base::StringPairs* stats) = 0; | 177 virtual void GetStats(base::StringPairs* stats) = 0; |
| 173 | 178 |
| 174 // Called whenever an external cache in the system reuses the resource | 179 // Called whenever an external cache in the system reuses the resource |
| 175 // referred to by |key|. | 180 // referred to by |key|. |
| 176 virtual void OnExternalCacheHit(const std::string& key) = 0; | 181 virtual void OnExternalCacheHit(const std::string& key) = 0; |
| 177 | 182 |
| 178 // Returns the estimate of dynamically allocated memory in bytes. | 183 // Returns the estimate of dynamically allocated memory in bytes. |
| 179 virtual size_t EstimateMemoryUsage() const = 0; | 184 virtual size_t DumpMemoryStats( |
| 185 base::trace_event::ProcessMemoryDump* pmd, |
| 186 const std::string& parent_absolute_name) const = 0; |
| 180 }; | 187 }; |
| 181 | 188 |
| 182 // This interface represents an entry in the disk cache. | 189 // This interface represents an entry in the disk cache. |
| 183 class NET_EXPORT Entry { | 190 class NET_EXPORT Entry { |
| 184 public: | 191 public: |
| 185 typedef net::CompletionCallback CompletionCallback; | 192 typedef net::CompletionCallback CompletionCallback; |
| 186 typedef net::IOBuffer IOBuffer; | 193 typedef net::IOBuffer IOBuffer; |
| 187 | 194 |
| 188 // Marks this cache entry for deletion. | 195 // Marks this cache entry for deletion. |
| 189 virtual void Doom() = 0; | 196 virtual void Doom() = 0; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 entry->Close(); | 353 entry->Close(); |
| 347 } | 354 } |
| 348 }; | 355 }; |
| 349 | 356 |
| 350 // Automatically closes an entry when it goes out of scope. | 357 // Automatically closes an entry when it goes out of scope. |
| 351 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; | 358 typedef std::unique_ptr<Entry, EntryDeleter> ScopedEntryPtr; |
| 352 | 359 |
| 353 } // namespace disk_cache | 360 } // namespace disk_cache |
| 354 | 361 |
| 355 #endif // NET_DISK_CACHE_DISK_CACHE_H_ | 362 #endif // NET_DISK_CACHE_DISK_CACHE_H_ |
| OLD | NEW |