Clean up PrefetchNextRegion.

Just to make it a little easier to read.

gfe-relnote: n/a, no functional change in QUIC v99-only method.
PiperOrigin-RevId: 254782688
Change-Id: Icb89655218af852b9da513f6313e91d0a1f973d0
diff --git a/quic/core/quic_stream_sequencer_buffer.cc b/quic/core/quic_stream_sequencer_buffer.cc
index 9d239b1..47211cc 100644
--- a/quic/core/quic_stream_sequencer_buffer.cc
+++ b/quic/core/quic_stream_sequencer_buffer.cc
@@ -344,20 +344,21 @@
     return false;
   }
 
-  size_t start_block_idx = GetBlockIndex(total_bytes_prefetched_);
-  size_t start_block_offset = GetInBlockOffset(total_bytes_prefetched_);
-  QuicStreamOffset readable_offset_end = FirstMissingByte() - 1;
-  size_t end_block_offset = GetInBlockOffset(readable_offset_end);
-  size_t end_block_idx = GetBlockIndex(readable_offset_end);
+  // Beginning of region.
+  size_t block_idx = GetBlockIndex(total_bytes_prefetched_);
+  size_t block_offset = GetInBlockOffset(total_bytes_prefetched_);
+  iov->iov_base = blocks_[block_idx]->buffer + block_offset;
 
-  if (start_block_idx != end_block_idx) {
-    iov->iov_base = blocks_[start_block_idx]->buffer + start_block_offset;
-    iov->iov_len = GetBlockCapacity(start_block_idx) - start_block_offset;
-    total_bytes_prefetched_ += iov->iov_len;
-    return true;
+  // Determine if entire block has been received.
+  size_t end_block_idx = GetBlockIndex(FirstMissingByte());
+  if (block_idx == end_block_idx) {
+    // Only read part of block before FirstMissingByte().
+    iov->iov_len = GetInBlockOffset(FirstMissingByte()) - block_offset;
+  } else {
+    // Read entire block.
+    iov->iov_len = GetBlockCapacity(block_idx) - block_offset;
   }
-  iov->iov_base = blocks_[end_block_idx]->buffer + start_block_offset;
-  iov->iov_len = end_block_offset - start_block_offset + 1;
+
   total_bytes_prefetched_ += iov->iov_len;
   return true;
 }