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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/quic/proto/cached_network_parameters.pb.h" | 9 #include "net/quic/proto/cached_network_parameters.pb.h" |
10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return; | 58 return; |
59 } | 59 } |
60 QuicSpdySession::OnStreamFrame(frame); | 60 QuicSpdySession::OnStreamFrame(frame); |
61 } | 61 } |
62 | 62 |
63 void QuicSimpleServerSession::PromisePushResources( | 63 void QuicSimpleServerSession::PromisePushResources( |
64 const string& request_url, | 64 const string& request_url, |
65 const std::list<QuicInMemoryCache::ServerPushInfo>& resources, | 65 const std::list<QuicInMemoryCache::ServerPushInfo>& resources, |
66 QuicStreamId original_stream_id, | 66 QuicStreamId original_stream_id, |
67 const SpdyHeaderBlock& original_request_headers) { | 67 const SpdyHeaderBlock& original_request_headers) { |
| 68 if (!server_push_enabled()) { |
| 69 return; |
| 70 } |
| 71 |
68 for (QuicInMemoryCache::ServerPushInfo resource : resources) { | 72 for (QuicInMemoryCache::ServerPushInfo resource : resources) { |
69 SpdyHeaderBlock headers = SynthesizePushRequestHeaders( | 73 SpdyHeaderBlock headers = SynthesizePushRequestHeaders( |
70 request_url, resource, original_request_headers); | 74 request_url, resource, original_request_headers); |
71 highest_promised_stream_id_ += 2; | 75 highest_promised_stream_id_ += 2; |
72 SendPushPromise(original_stream_id, highest_promised_stream_id_, headers); | 76 SendPushPromise(original_stream_id, highest_promised_stream_id_, headers); |
73 promised_streams_.push_back(PromisedStreamInfo( | 77 promised_streams_.push_back(PromisedStreamInfo( |
74 headers, highest_promised_stream_id_, resource.priority)); | 78 headers, highest_promised_stream_id_, resource.priority)); |
75 } | 79 } |
76 | 80 |
77 // Procese promised push request as many as possible. | 81 // Procese promised push request as many as possible. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 DVLOG(1) << "created server push stream " << promised_stream->id(); | 193 DVLOG(1) << "created server push stream " << promised_stream->id(); |
190 | 194 |
191 const SpdyHeaderBlock request_headers(promised_info.request_headers); | 195 const SpdyHeaderBlock request_headers(promised_info.request_headers); |
192 | 196 |
193 promised_streams_.pop_front(); | 197 promised_streams_.pop_front(); |
194 promised_stream->PushResponse(request_headers); | 198 promised_stream->PushResponse(request_headers); |
195 } | 199 } |
196 } | 200 } |
197 | 201 |
198 } // namespace net | 202 } // namespace net |
OLD | NEW |