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

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

Issue 2874833005: SimpleCache: read small files all at once. (Closed)
Patch Set: Apply most of review feedback, still need to deal with the struct thing Created 3 years, 4 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..efd673aae5d54088dd6d1d43ba087fba30892d96 100644
--- a/net/disk_cache/simple/simple_entry_impl.h
+++ b/net/disk_cache/simple/simple_entry_impl.h
@@ -301,9 +301,11 @@ class NET_EXPORT_PRIVATE SimpleEntryImpl : public Entry,
int result,
std::unique_ptr<SimpleSynchronousEntry::CRCRequest> crc_result) const;
- // Called after completion of asynchronous IO and receiving file metadata for
- // the entry in |entry_stat|. Updates the metadata in the entry and in the
- // index to make them available on next IO operations.
+ // Called after completion of an operation, to either incoproprate file info
+ // received from I/O done on the worker pool, or to simply bump the
+ // timestamps. Updates the metadata both in |this| and in the index.
+ // Stream size information in particular may be important for following
+ // operations.
void UpdateDataFromEntryStat(const SimpleEntryStat& entry_stat);
int64_t GetDiskUsage() const;
@@ -312,8 +314,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
pasko 2017/08/09 12:28:22 nit: s/as appropriate//
Maks Orlovich 2017/08/09 15:25:02 Done.
+ // be posted to with the return code.
pasko 2017/08/09 12:28:22 s/posted to/posted to the current task runner/ ? .
Maks Orlovich 2017/08/09 15:25:02 Done.
+ void ReadFromBufferAndPostReply(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|
@@ -341,6 +349,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 +412,11 @@ 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.
+ // 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