Do not call GetPushedStream if there is no pushed stream.
Do not call SpdySession::GetPushedStream() from
SpdyHttpStream::InitializeStream() if
|pushed_stream_id_ == kNoPushedStreamFound|. Pushed streams are claimed
by Http2PushPromiseIndex::ClaimPushedStream(), there is no need to do an
extra lookup in the index if a pushed stream was not found the first
time.
This is a follow-up to
https://chromium-review.googlesource.com/c/chromium/src/+/829993/2/net/spdy/chromium/spdy_http_stream.cc#85.
Note that it is possible that a stream was created after the
Http2PushPromiseIndex::ClaimPushedStream() call but before
SpdySession::GetPushedStream() is called (they do not happen
synchronously). In two unittests, mock read data has to be reordered to
make sure pushed stream is claimed.
Http2PushPromiseIndex::ClaimPushedStream() calls are added to some other
unittests to make sure the stream is not in the index by the time
SpdySession::GetPushedStream() is called.
Bug: 799937
Change-Id: If91fe95fd65362a9c650b502402796deb251e887
Reviewed-on: https://chromium-review.googlesource.com/857278
Reviewed-by: Helen Li <[email protected]>
Commit-Queue: Bence Béky <[email protected]>
Cr-Commit-Position: refs/heads/master@{#528290}
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc
index c05e021..25ae85c 100644
--- a/net/http/http_network_transaction_unittest.cc
+++ b/net/http/http_network_transaction_unittest.cc
@@ -8512,20 +8512,21 @@
CreateMockWrite(stream2_priority, 3, ASYNC),
};
+ SpdySerializedFrame stream2_syn(spdy_util_.ConstructSpdyPush(
+ NULL, 0, 2, 1, "http://www.another-origin.com/foo.dat"));
+
SpdySerializedFrame stream1_reply(
spdy_util_.ConstructSpdyGetReply(NULL, 0, 1));
SpdySerializedFrame stream1_body(spdy_util_.ConstructSpdyDataFrame(1, true));
- SpdySerializedFrame stream2_syn(spdy_util_.ConstructSpdyPush(
- NULL, 0, 2, 1, "http://www.another-origin.com/foo.dat"));
const char kPushedData[] = "pushed";
SpdySerializedFrame stream2_body(spdy_util_.ConstructSpdyDataFrame(
2, kPushedData, strlen(kPushedData), true));
MockRead spdy_reads[] = {
- CreateMockRead(stream1_reply, 1, ASYNC),
- CreateMockRead(stream2_syn, 2, ASYNC),
+ CreateMockRead(stream2_syn, 1, ASYNC),
+ CreateMockRead(stream1_reply, 2, ASYNC),
CreateMockRead(stream1_body, 4, ASYNC),
CreateMockRead(stream2_body, 5, ASYNC),
MockRead(SYNCHRONOUS, ERR_IO_PENDING, 6), // Force a hang