Chromium Code Reviews| 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(); |