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

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

Issue 2807433002: SimpleCache: synchronously reply on reads from idle if data is in memory.
Patch Set: Benchmark for simple reads; meant to help evaluate any changes to early dispatch logic in general. Created 3 years, 8 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
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/simple/simple_entry_impl.cc
diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
index 2b354cd0f68043a93b4f70956991a7261a2e422b..ea30b674fb851fc2f3af637315bf825f0be13076 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -387,12 +387,15 @@ int SimpleEntryImpl::ReadData(int stream_index,
return 0;
}
- // TODO(clamy): return immediatly when reading from stream 0.
-
// TODO(felipeg): Optimization: Add support for truly parallel read
pasko 2017/04/07 16:13:39 fyi: this one did not show much opportunity on the
// operations.
bool alone_in_queue =
pending_operations_.size() == 0 && state_ == STATE_READY;
+ if (alone_in_queue && stream_index == 0) {
+ buf_len = std::min(buf_len, GetDataSize(stream_index) - offset);
+ return ReadStream0Data(buf, offset, buf_len);
+ }
+
pending_operations_.push(SimpleEntryOperation::ReadOperation(
this, stream_index, offset, buf_len, buf, callback, alone_in_queue));
RunNextOperationIfNeeded();
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698