Index: net/disk_cache/simple/simple_entry_impl.h |
diff --git a/net/disk_cache/simple/simple_entry_impl.h b/net/disk_cache/simple/simple_entry_impl.h |
index 7ab6c38e4ef1bd55d1ba8a60a258dbfee94afca0..246ffd471e93c9794f9bb276e16761864179b1c6 100644 |
--- a/net/disk_cache/simple/simple_entry_impl.h |
+++ b/net/disk_cache/simple/simple_entry_impl.h |
@@ -312,8 +312,14 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, |
void RecordReadIsParallelizable(const SimpleEntryOperation& operation) const; |
void RecordWriteDependencyType(const SimpleEntryOperation& operation) const; |
- // Reads from the stream 0 data kept in memory. |
- int ReadStream0Data(net::IOBuffer* buf, int offset, int buf_len); |
+ // Completes a read from the stream data kept in memory, logging metrics |
+ // and updating metadata as appropriate. If |callback| is non-null, it will |
+ // be posted to with the return code. |
+ void ReadInMemoryStreamData(net::GrowableIOBuffer* in_buf, |
pasko
2017/08/04 01:28:34
naming bikeshed: 'Stream' is slightly confusing be
Maks Orlovich
2017/08/04 18:35:44
Done.
|
+ int offset, |
+ int buf_len, |
+ net::IOBuffer* out_buf, |
+ const CompletionCallback& callback); |
// Copies data from |buf| to the internal in-memory buffer for stream 0. If |
// |truncate| is set to true, the target buffer will be truncated at |offset| |
@@ -341,6 +347,7 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, |
const base::FilePath path_; |
const uint64_t entry_hash_; |
const bool use_optimistic_operations_; |
+ bool is_initial_stream1_read_; // used for metrics only. |
std::string key_; |
// |last_used_|, |last_modified_| and |data_size_| are copied from the |
@@ -403,6 +410,12 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry, |
// used to write HTTP headers, the memory consumption of keeping it in memory |
// is acceptable. |
scoped_refptr<net::GrowableIOBuffer> stream_0_data_; |
+ |
+ // Sometimes stream 1 data is prefetched when stream 0 is first read, to make |
+ // the first read call on stream 1 synchronous. If a write to the stream |
pasko
2017/08/04 01:28:34
oops, it's not synchronous because we PostTask eve
Maks Orlovich
2017/08/04 18:35:43
So did I, actually. I think this was the original
|
+ // occurs on the entry the prefetch buffer is discarded. It may also be |
+ // null if it wasn't prefetched in the first place. |
+ scoped_refptr<net::GrowableIOBuffer> stream_1_prefetch_data_; |
}; |
} // namespace disk_cache |