Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Unified Diff: net/disk_cache/simple/simple_entry_impl.h

Issue 2874833005: SimpleCache: read small files all at once. (Closed)
Patch Set: Rename + comment a method. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..13d9d22b1a6c7b4817b6ceb216a636cd594b9183 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,
+ 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|
@@ -403,6 +409,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
+ // 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

Powered by Google App Engine
This is Rietveld 408576698