Cancel expired HTTP/2 pushed streams even if no other stream is pushed.

The current method for cancelling HTTP/2 pushed streams is only executed
when a new pushed stream arrives, that is, a pushed stream can hang
around forever if the server sends no other pushed streams.  Also,
calling DeleteExpiredPushedStreams() from a method like
TryCreatePushStream() that manipulates pushed stream iterators is
potentially error-prone, see https://crbug.com/443490.  This CL changes
the expiration method to reset a single pushed stream if unclaimed, and
posttasks that method with a delay.

Also, increase |bytes_pushed_and_unclaimed_count_| in
CloseActiveStreamIterator() instead of in the method that closes an
expired stream, so that unclaimed pushed bytes are accounted for from a
pushed stream which is unclaimed and unexpired when SpdySession is
closed.  (There was no test coverage for this, but now
CancelPushAfterSessionGoesAway covers this, because the pushed stream is
not expired in this test any longer.)

Also add a NOTREACHED() in CancelPushedStreamIfUnclaimed(), because if
stream is in unclaimed_pushed_streams_, then it must also be in
active_streams_.

Bug: 554220
Change-Id: Ica5b7de8d580effcec05710e90ccbcc4eb2c1889
Reviewed-on: https://chromium-review.googlesource.com/776155
Commit-Queue: Bence Béky <bnc@chromium.org>
Reviewed-by: Zhongyi Shi <zhongyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520008}
3 files changed