| 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // Unlike other streams, stream 0 data is read from the disk when the entry is | 384 // Unlike other streams, stream 0 data is read from the disk when the entry is |
| 385 // opened, and then kept in memory. All read/write operations on stream 0 | 385 // opened, and then kept in memory. All read/write operations on stream 0 |
| 386 // affect the |stream_0_data_| buffer. When the entry is closed, | 386 // affect the |stream_0_data_| buffer. When the entry is closed, |
| 387 // |stream_0_data_| is written to the disk. | 387 // |stream_0_data_| is written to the disk. |
| 388 // Stream 0 is kept in memory because it is stored in the same file as stream | 388 // Stream 0 is kept in memory because it is stored in the same file as stream |
| 389 // 1 on disk, to reduce the number of file descriptors and save disk space. | 389 // 1 on disk, to reduce the number of file descriptors and save disk space. |
| 390 // This strategy allows stream 1 to change size easily. Since stream 0 is only | 390 // This strategy allows stream 1 to change size easily. Since stream 0 is only |
| 391 // used to write HTTP headers, the memory consumption of keeping it in memory | 391 // used to write HTTP headers, the memory consumption of keeping it in memory |
| 392 // is acceptable. | 392 // is acceptable. |
| 393 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; | 393 scoped_refptr<net::GrowableIOBuffer> stream_0_data_; |
| 394 |
| 395 // Some stream 1 data is prefetched when stream 0 is first read, to make the |
| 396 // first read call on stream 1 synchronous. If a write to any stream occurs |
| 397 // on the entry the prefetch buffer is no longer used. |
| 398 scoped_refptr<net::GrowableIOBuffer> stream_1_prefetch_data_; |
| 394 }; | 399 }; |
| 395 | 400 |
| 396 } // namespace disk_cache | 401 } // namespace disk_cache |
| 397 | 402 |
| 398 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ | 403 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_IMPL_H_ |
| OLD | NEW |