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

Side by Side Diff: net/spdy/spdy_session.cc

Issue 2456713002: Server push cancellation: add methods in session layer to cancel push given the pushed url. Not in … (Closed)
Patch Set: address rch's comments Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_session.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 NOTREACHED(); 2630 NOTREACHED();
2631 return false; 2631 return false;
2632 } 2632 }
2633 2633
2634 active_it->second.stream->OnPushPromiseHeadersReceived(std::move(headers)); 2634 active_it->second.stream->OnPushPromiseHeadersReceived(std::move(headers));
2635 DCHECK(active_it->second.stream->IsReservedRemote()); 2635 DCHECK(active_it->second.stream->IsReservedRemote());
2636 num_pushed_streams_++; 2636 num_pushed_streams_++;
2637 return true; 2637 return true;
2638 } 2638 }
2639 2639
2640 void SpdySession::CancelPush(const GURL& url) {
2641 UnclaimedPushedStreamContainer::const_iterator unclaimed_it =
2642 unclaimed_pushed_streams_.find(url);
2643 if (unclaimed_it == unclaimed_pushed_streams_.end())
2644 return;
2645
2646 SpdyStreamId stream_id = unclaimed_it->second.stream_id;
2647
2648 if (active_streams_.find(stream_id) == active_streams_.end()) {
2649 ResetStream(stream_id, RST_STREAM_CANCEL,
2650 "Cancelled push stream with url: " + url.spec());
2651 }
2652 unclaimed_pushed_streams_.erase(unclaimed_it);
2653 }
2654
2640 void SpdySession::OnPushPromise(SpdyStreamId stream_id, 2655 void SpdySession::OnPushPromise(SpdyStreamId stream_id,
2641 SpdyStreamId promised_stream_id, 2656 SpdyStreamId promised_stream_id,
2642 SpdyHeaderBlock headers) { 2657 SpdyHeaderBlock headers) {
2643 CHECK(in_io_loop_); 2658 CHECK(in_io_loop_);
2644 2659
2645 if (net_log_.IsCapturing()) { 2660 if (net_log_.IsCapturing()) {
2646 net_log_.AddEvent(NetLogEventType::HTTP2_SESSION_RECV_PUSH_PROMISE, 2661 net_log_.AddEvent(NetLogEventType::HTTP2_SESSION_RECV_PUSH_PROMISE,
2647 base::Bind(&NetLogSpdyPushPromiseReceivedCallback, 2662 base::Bind(&NetLogSpdyPushPromiseReceivedCallback,
2648 &headers, stream_id, promised_stream_id)); 2663 &headers, stream_id, promised_stream_id));
2649 } 2664 }
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
3116 if (!queue->empty()) { 3131 if (!queue->empty()) {
3117 SpdyStreamId stream_id = queue->front(); 3132 SpdyStreamId stream_id = queue->front();
3118 queue->pop_front(); 3133 queue->pop_front();
3119 return stream_id; 3134 return stream_id;
3120 } 3135 }
3121 } 3136 }
3122 return 0; 3137 return 0;
3123 } 3138 }
3124 3139
3125 } // namespace net 3140 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698