| 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_ENTRY_IMPL_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 int OpenEntry(Entry** entry, const CompletionCallback& callback); | 72 int OpenEntry(Entry** entry, const CompletionCallback& callback); |
| 73 | 73 |
| 74 // Creates this entry, if possible. Returns |this| to |entry|. | 74 // Creates this entry, if possible. Returns |this| to |entry|. |
| 75 int CreateEntry(Entry** entry, const CompletionCallback& callback); | 75 int CreateEntry(Entry** entry, const CompletionCallback& callback); |
| 76 | 76 |
| 77 // Identical to Backend::Doom() except that it accepts a CompletionCallback. | 77 // Identical to Backend::Doom() except that it accepts a CompletionCallback. |
| 78 int DoomEntry(const CompletionCallback& callback); | 78 int DoomEntry(const CompletionCallback& callback); |
| 79 | 79 |
| 80 const std::string& key() const { return key_; } | 80 const std::string& key() const { return key_; } |
| 81 uint64_t entry_hash() const { return entry_hash_; } | 81 uint64_t entry_hash() const { return entry_hash_; } |
| 82 |
| 83 // The key is not a constructor parameter to the SimpleEntryImpl, because |
| 84 // during cache iteration, it's necessary to open entries by their hash |
| 85 // alone. In that case, the SimpleSynchronousEntry will read the key from disk |
| 86 // and it will be set. |
| 82 void SetKey(const std::string& key); | 87 void SetKey(const std::string& key); |
| 83 | 88 |
| 84 // From Entry: | 89 // From Entry: |
| 85 void Doom() override; | 90 void Doom() override; |
| 86 void Close() override; | 91 void Close() override; |
| 87 std::string GetKey() const override; | 92 std::string GetKey() const override; |
| 88 base::Time GetLastUsed() const override; | 93 base::Time GetLastUsed() const override; |
| 89 base::Time GetLastModified() const override; | 94 base::Time GetLastModified() const override; |
| 90 int32_t GetDataSize(int index) const override; | 95 int32_t GetDataSize(int index) const override; |
| 91 int ReadData(int stream_index, | 96 int ReadData(int stream_index, |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 // 1 on disk, to reduce the number of file descriptors and save disk space. | 380 // 1 on disk, to reduce the number of file descriptors and save disk space. |
| 376 // This strategy allows stream 1 to change size easily. Since stream 0 is only | 381 // This strategy allows stream 1 to change size easily. Since stream 0 is only |
| 377 // used to write HTTP headers, the memory consumption of keeping it in memory | 382 // used to write HTTP headers, the memory consumption of keeping it in memory |
| 378 // is acceptable. | 383 // is acceptable. |
| 379 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; | 384 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; |
| 380 }; | 385 }; |
| 381 | 386 |
| 382 } // namespace disk_cache | 387 } // namespace disk_cache |
| 383 | 388 |
| 384 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 389 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| OLD | NEW |