| OLD | NEW |
| 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/tools/quic/quic_simple_server_session.h" | 5 #include "net/tools/quic/quic_simple_server_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "net/quic/core/proto/cached_network_parameters.pb.h" | 9 #include "net/quic/core/proto/cached_network_parameters.pb.h" |
| 10 #include "net/quic/core/quic_connection.h" | 10 #include "net/quic/core/quic_connection.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 spdy_headers.erase("host"); | 171 spdy_headers.erase("host"); |
| 172 return spdy_headers; | 172 return spdy_headers; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void QuicSimpleServerSession::SendPushPromise(QuicStreamId original_stream_id, | 175 void QuicSimpleServerSession::SendPushPromise(QuicStreamId original_stream_id, |
| 176 QuicStreamId promised_stream_id, | 176 QuicStreamId promised_stream_id, |
| 177 SpdyHeaderBlock headers) { | 177 SpdyHeaderBlock headers) { |
| 178 QUIC_DLOG(INFO) << "stream " << original_stream_id | 178 QUIC_DLOG(INFO) << "stream " << original_stream_id |
| 179 << " send PUSH_PROMISE for promised stream " | 179 << " send PUSH_PROMISE for promised stream " |
| 180 << promised_stream_id; | 180 << promised_stream_id; |
| 181 if (visitor_) { |
| 182 visitor_->OnPushPromiseSent(); |
| 183 } |
| 181 WritePushPromise(original_stream_id, promised_stream_id, std::move(headers)); | 184 WritePushPromise(original_stream_id, promised_stream_id, std::move(headers)); |
| 182 } | 185 } |
| 183 | 186 |
| 184 void QuicSimpleServerSession::HandlePromisedPushRequests() { | 187 void QuicSimpleServerSession::HandlePromisedPushRequests() { |
| 185 while (!promised_streams_.empty() && ShouldCreateOutgoingDynamicStream()) { | 188 while (!promised_streams_.empty() && ShouldCreateOutgoingDynamicStream()) { |
| 186 PromisedStreamInfo& promised_info = promised_streams_.front(); | 189 PromisedStreamInfo& promised_info = promised_streams_.front(); |
| 187 DCHECK_EQ(next_outgoing_stream_id(), promised_info.stream_id); | 190 DCHECK_EQ(next_outgoing_stream_id(), promised_info.stream_id); |
| 188 | 191 |
| 189 if (promised_info.is_cancelled) { | 192 if (promised_info.is_cancelled) { |
| 190 // This stream has been reset by client. Skip this stream id. | 193 // This stream has been reset by client. Skip this stream id. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 201 QUIC_DLOG(INFO) << "created server push stream " << promised_stream->id(); | 204 QUIC_DLOG(INFO) << "created server push stream " << promised_stream->id(); |
| 202 | 205 |
| 203 SpdyHeaderBlock request_headers(std::move(promised_info.request_headers)); | 206 SpdyHeaderBlock request_headers(std::move(promised_info.request_headers)); |
| 204 | 207 |
| 205 promised_streams_.pop_front(); | 208 promised_streams_.pop_front(); |
| 206 promised_stream->PushResponse(std::move(request_headers)); | 209 promised_stream->PushResponse(std::move(request_headers)); |
| 207 } | 210 } |
| 208 } | 211 } |
| 209 | 212 |
| 210 } // namespace net | 213 } // namespace net |
| OLD | NEW |