| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 int buf_len, | 115 int buf_len, |
| 116 const CompletionCallback& callback) override; | 116 const CompletionCallback& callback) override; |
| 117 int GetAvailableRange(int64_t offset, | 117 int GetAvailableRange(int64_t offset, |
| 118 int len, | 118 int len, |
| 119 int64_t* start, | 119 int64_t* start, |
| 120 const CompletionCallback& callback) override; | 120 const CompletionCallback& callback) override; |
| 121 bool CouldBeSparse() const override; | 121 bool CouldBeSparse() const override; |
| 122 void CancelSparseIO() override; | 122 void CancelSparseIO() override; |
| 123 int ReadyForSparseIO(const CompletionCallback& callback) override; | 123 int ReadyForSparseIO(const CompletionCallback& callback) override; |
| 124 | 124 |
| 125 // Returns the estimate of dynamically allocated memory in bytes. |
| 126 size_t EstimateMemoryUsage() const; |
| 127 |
| 125 private: | 128 private: |
| 126 class ScopedOperationRunner; | 129 class ScopedOperationRunner; |
| 127 friend class ScopedOperationRunner; | 130 friend class ScopedOperationRunner; |
| 128 | 131 |
| 129 enum State { | 132 enum State { |
| 130 // The state immediately after construction, but before |synchronous_entry_| | 133 // The state immediately after construction, but before |synchronous_entry_| |
| 131 // has been assigned. This is the state at construction, and is the only | 134 // has been assigned. This is the state at construction, and is the only |
| 132 // legal state to destruct an entry in. | 135 // legal state to destruct an entry in. |
| 133 STATE_UNINITIALIZED, | 136 STATE_UNINITIALIZED, |
| 134 | 137 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // 1 on disk, to reduce the number of file descriptors and save disk space. | 385 // 1 on disk, to reduce the number of file descriptors and save disk space. |
| 383 // This strategy allows stream 1 to change size easily. Since stream 0 is only | 386 // This strategy allows stream 1 to change size easily. Since stream 0 is only |
| 384 // used to write HTTP headers, the memory consumption of keeping it in memory | 387 // used to write HTTP headers, the memory consumption of keeping it in memory |
| 385 // is acceptable. | 388 // is acceptable. |
| 386 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; | 389 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; |
| 387 }; | 390 }; |
| 388 | 391 |
| 389 } // namespace disk_cache | 392 } // namespace disk_cache |
| 390 | 393 |
| 391 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 394 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| OLD | NEW |