Commit 2b5725c3 authored by Bence Béky's avatar Bence Béky Committed by Chromium LUCI CQ

Simplify frame type handling in SpdyStream method.

In SpdyStream::OnFrameWriteComplete(), remove early returns for
specific, allowed frame types, remove CHECK on frame type, and replace
them with an early return for any frame type other than HEADERS and
DATA.  The CHECK was not particularily useful, since it is okay not to
take action when a frame write is complete, but with the CHECK in place
one is forced to modify this method when adding a new frame type (that
is why the reserved frame type logic got in there at
https://crrev.com/c/1207750).  This change makes the code easier to
extend with potential future frame types like PRIORITY_UPDATE.

Removing hardcoded reserved frame types formula is also beneficial,
because special treatment of reserved frame types is potentially
error-prone, and also goes against the spirit of GREASE.

Change-Id: I53efa954411db42af051b4a06c7c3b30b969b0b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2615479Reviewed-by: default avatarDavid Schinazi <dschinazi@chromium.org>
Commit-Queue: Bence Béky <bnc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843002}
parent 2a21b107
......@@ -600,21 +600,12 @@ void SpdyStream::OnPaddingConsumed(size_t len) {
void SpdyStream::OnFrameWriteComplete(spdy::SpdyFrameType frame_type,
size_t frame_size) {
// PRIORITY writes are allowed at any time and do not trigger a state update.
if (frame_type == spdy::SpdyFrameType::PRIORITY) {
if (frame_type != spdy::SpdyFrameType::HEADERS &&
frame_type != spdy::SpdyFrameType::DATA) {
return;
}
// Frame types reserved in
// https://tools.ietf.org/html/draft-bishop-httpbis-grease-00 ought to be
// ignored.
if (static_cast<uint8_t>(frame_type) % 0x1f == 0x0b)
return;
DCHECK_NE(type_, SPDY_PUSH_STREAM);
CHECK(frame_type == spdy::SpdyFrameType::HEADERS ||
frame_type == spdy::SpdyFrameType::DATA)
<< frame_type;
int result = (frame_type == spdy::SpdyFrameType::HEADERS)
? OnHeadersSent()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment