Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: net/quic/chromium/quic_chromium_client_session.cc

Issue 2456713002: Server push cancellation: add methods in session layer to cancel push given the pushed url. Not in … (Closed)
Patch Set: remove todo Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/chromium/quic_chromium_client_session.cc
diff --git a/net/quic/chromium/quic_chromium_client_session.cc b/net/quic/chromium/quic_chromium_client_session.cc
index 081aff1e1b7d3d8cf89b5a08b38c72331d6dfb15..15438d7c726324bcf8103b41ead8f13ac9534ca2 100644
--- a/net/quic/chromium/quic_chromium_client_session.cc
+++ b/net/quic/chromium/quic_chromium_client_session.cc
@@ -1434,6 +1434,26 @@ void QuicChromiumClientSession::OnPushStreamTimedOut(QuicStreamId stream_id) {
bytes_pushed_and_unclaimed_count_ += stream->stream_bytes_read();
}
+void QuicChromiumClientSession::CancelPush(const GURL& url) {
+ QuicClientPromisedInfo* promised_info =
+ QuicClientSessionBase::GetPromisedByUrl(url.spec());
+ if (!promised_info) {
+ // Push stream has already been claimed.
+ return;
+ }
+
+ QuicStreamId stream_id = promised_info->id();
+
+ // Collect data on the cancelled push stream.
+ QuicSpdyStream* stream = GetPromisedStream(stream_id);
+ if (stream != nullptr)
+ bytes_pushed_and_unclaimed_count_ += stream->stream_bytes_read();
+
+ // Remove the promised info from the promise index and send the reset.
+ DeletePromised(promised_info);
Ryan Hamilton 2016/10/27 17:00:25 I'm a bit surprised to see the delete before the r
Zhongyi Shi 2016/10/27 17:57:29 The other order also works. DeletePromised() delet
+ QuicClientSessionBase::ResetPromised(stream_id, QUIC_STREAM_CANCELLED);
+}
+
const LoadTimingInfo::ConnectTiming&
QuicChromiumClientSession::GetConnectTiming() {
connect_timing_.ssl_start = connect_timing_.connect_start;

Powered by Google App Engine
This is Rietveld 408576698