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

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

Issue 1852423004: Implement SpdySerializedFrame move semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_pool_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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 void SpdySession::EnqueueStreamWrite( 1078 void SpdySession::EnqueueStreamWrite(
1079 const base::WeakPtr<SpdyStream>& stream, 1079 const base::WeakPtr<SpdyStream>& stream,
1080 SpdyFrameType frame_type, 1080 SpdyFrameType frame_type,
1081 scoped_ptr<SpdyBufferProducer> producer) { 1081 scoped_ptr<SpdyBufferProducer> producer) {
1082 DCHECK(frame_type == HEADERS || 1082 DCHECK(frame_type == HEADERS ||
1083 frame_type == DATA || 1083 frame_type == DATA ||
1084 frame_type == SYN_STREAM); 1084 frame_type == SYN_STREAM);
1085 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream); 1085 EnqueueWrite(stream->priority(), frame_type, std::move(producer), stream);
1086 } 1086 }
1087 1087
1088 scoped_ptr<SpdyFrame> SpdySession::CreateSynStream( 1088 scoped_ptr<SpdySerializedFrame> SpdySession::CreateSynStream(
1089 SpdyStreamId stream_id, 1089 SpdyStreamId stream_id,
1090 RequestPriority priority, 1090 RequestPriority priority,
1091 SpdyControlFlags flags, 1091 SpdyControlFlags flags,
1092 const SpdyHeaderBlock& block) { 1092 const SpdyHeaderBlock& block) {
1093 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); 1093 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id);
1094 CHECK(it != active_streams_.end()); 1094 CHECK(it != active_streams_.end());
1095 CHECK_EQ(it->second.stream->stream_id(), stream_id); 1095 CHECK_EQ(it->second.stream->stream_id(), stream_id);
1096 1096
1097 SendPrefacePingIfNoneInFlight(); 1097 SendPrefacePingIfNoneInFlight();
1098 1098
1099 DCHECK(buffered_spdy_framer_.get()); 1099 DCHECK(buffered_spdy_framer_.get());
1100 SpdyPriority spdy_priority = 1100 SpdyPriority spdy_priority =
1101 ConvertRequestPriorityToSpdyPriority(priority, GetProtocolVersion()); 1101 ConvertRequestPriorityToSpdyPriority(priority, GetProtocolVersion());
1102 1102
1103 scoped_ptr<SpdyFrame> syn_frame; 1103 scoped_ptr<SpdySerializedFrame> syn_frame;
1104 // TODO(hkhalil): Avoid copy of |block|. 1104 // TODO(hkhalil): Avoid copy of |block|.
1105 if (GetProtocolVersion() <= SPDY3) { 1105 if (GetProtocolVersion() <= SPDY3) {
1106 SpdySynStreamIR syn_stream(stream_id); 1106 SpdySynStreamIR syn_stream(stream_id);
1107 syn_stream.set_associated_to_stream_id(0); 1107 syn_stream.set_associated_to_stream_id(0);
1108 syn_stream.set_priority(spdy_priority); 1108 syn_stream.set_priority(spdy_priority);
1109 syn_stream.set_fin((flags & CONTROL_FLAG_FIN) != 0); 1109 syn_stream.set_fin((flags & CONTROL_FLAG_FIN) != 0);
1110 syn_stream.set_unidirectional((flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0); 1110 syn_stream.set_unidirectional((flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0);
1111 syn_stream.set_header_block(block); 1111 syn_stream.set_header_block(block);
1112 syn_frame.reset(buffered_spdy_framer_->SerializeFrame(syn_stream)); 1112 syn_frame.reset(new SpdySerializedFrame(
1113 buffered_spdy_framer_->SerializeFrame(syn_stream)));
1113 1114
1114 if (net_log().IsCapturing()) { 1115 if (net_log().IsCapturing()) {
1115 net_log().AddEvent(NetLog::TYPE_HTTP2_SESSION_SYN_STREAM, 1116 net_log().AddEvent(NetLog::TYPE_HTTP2_SESSION_SYN_STREAM,
1116 base::Bind(&NetLogSpdySynStreamSentCallback, &block, 1117 base::Bind(&NetLogSpdySynStreamSentCallback, &block,
1117 (flags & CONTROL_FLAG_FIN) != 0, 1118 (flags & CONTROL_FLAG_FIN) != 0,
1118 (flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0, 1119 (flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0,
1119 spdy_priority, stream_id)); 1120 spdy_priority, stream_id));
1120 } 1121 }
1121 } else { 1122 } else {
1122 SpdyHeadersIR headers(stream_id); 1123 SpdyHeadersIR headers(stream_id);
1123 headers.set_priority(spdy_priority); 1124 headers.set_priority(spdy_priority);
1124 headers.set_has_priority(true); 1125 headers.set_has_priority(true);
1125 1126
1126 if (priority_dependencies_enabled_) { 1127 if (priority_dependencies_enabled_) {
1127 SpdyStreamId dependent_stream_id = 0; 1128 SpdyStreamId dependent_stream_id = 0;
1128 bool exclusive = false; 1129 bool exclusive = false;
1129 priority_dependency_state_.OnStreamSynSent( 1130 priority_dependency_state_.OnStreamSynSent(
1130 stream_id, spdy_priority, &dependent_stream_id, &exclusive); 1131 stream_id, spdy_priority, &dependent_stream_id, &exclusive);
1131 headers.set_parent_stream_id(dependent_stream_id); 1132 headers.set_parent_stream_id(dependent_stream_id);
1132 headers.set_exclusive(exclusive); 1133 headers.set_exclusive(exclusive);
1133 } 1134 }
1134 1135
1135 headers.set_fin((flags & CONTROL_FLAG_FIN) != 0); 1136 headers.set_fin((flags & CONTROL_FLAG_FIN) != 0);
1136 headers.set_header_block(block); 1137 headers.set_header_block(block);
1137 syn_frame.reset(buffered_spdy_framer_->SerializeFrame(headers)); 1138 syn_frame.reset(new SpdySerializedFrame(
1139 buffered_spdy_framer_->SerializeFrame(headers)));
1138 1140
1139 if (net_log().IsCapturing()) { 1141 if (net_log().IsCapturing()) {
1140 net_log().AddEvent( 1142 net_log().AddEvent(
1141 NetLog::TYPE_HTTP2_SESSION_SEND_HEADERS, 1143 NetLog::TYPE_HTTP2_SESSION_SEND_HEADERS,
1142 base::Bind(&NetLogSpdyHeadersSentCallback, &block, 1144 base::Bind(&NetLogSpdyHeadersSentCallback, &block,
1143 (flags & CONTROL_FLAG_FIN) != 0, stream_id, 1145 (flags & CONTROL_FLAG_FIN) != 0, stream_id,
1144 headers.has_priority(), headers.priority(), 1146 headers.has_priority(), headers.priority(),
1145 headers.parent_stream_id(), headers.exclusive())); 1147 headers.parent_stream_id(), headers.exclusive()));
1146 } 1148 }
1147 } 1149 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 base::Bind(&NetLogSpdyDataCallback, stream_id, 1237 base::Bind(&NetLogSpdyDataCallback, stream_id,
1236 effective_len, (flags & DATA_FLAG_FIN) != 0)); 1238 effective_len, (flags & DATA_FLAG_FIN) != 0));
1237 } 1239 }
1238 1240
1239 // Send PrefacePing for DATA_FRAMEs with nonzero payload size. 1241 // Send PrefacePing for DATA_FRAMEs with nonzero payload size.
1240 if (effective_len > 0) 1242 if (effective_len > 0)
1241 SendPrefacePingIfNoneInFlight(); 1243 SendPrefacePingIfNoneInFlight();
1242 1244
1243 // TODO(mbelshe): reduce memory copies here. 1245 // TODO(mbelshe): reduce memory copies here.
1244 DCHECK(buffered_spdy_framer_.get()); 1246 DCHECK(buffered_spdy_framer_.get());
1245 scoped_ptr<SpdyFrame> frame(buffered_spdy_framer_->CreateDataFrame( 1247 scoped_ptr<SpdySerializedFrame> frame(buffered_spdy_framer_->CreateDataFrame(
1246 stream_id, data->data(), static_cast<uint32_t>(effective_len), flags)); 1248 stream_id, data->data(), static_cast<uint32_t>(effective_len), flags));
1247 1249
1248 scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(std::move(frame))); 1250 scoped_ptr<SpdyBuffer> data_buffer(new SpdyBuffer(std::move(frame)));
1249 1251
1250 // Send window size is based on payload size, so nothing to do if this is 1252 // Send window size is based on payload size, so nothing to do if this is
1251 // just a FIN with no payload. 1253 // just a FIN with no payload.
1252 if (effective_len != 0) { 1254 if (effective_len != 0) {
1253 DecreaseSendWindowSize(static_cast<int32_t>(effective_len)); 1255 DecreaseSendWindowSize(static_cast<int32_t>(effective_len));
1254 data_buffer->AddConsumeCallback( 1256 data_buffer->AddConsumeCallback(
1255 base::Bind(&SpdySession::OnWriteBufferConsumed, 1257 base::Bind(&SpdySession::OnWriteBufferConsumed,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1368 RequestPriority priority, 1370 RequestPriority priority,
1369 SpdyRstStreamStatus status, 1371 SpdyRstStreamStatus status,
1370 const std::string& description) { 1372 const std::string& description) {
1371 DCHECK_NE(stream_id, 0u); 1373 DCHECK_NE(stream_id, 0u);
1372 1374
1373 net_log().AddEvent( 1375 net_log().AddEvent(
1374 NetLog::TYPE_HTTP2_SESSION_SEND_RST_STREAM, 1376 NetLog::TYPE_HTTP2_SESSION_SEND_RST_STREAM,
1375 base::Bind(&NetLogSpdyRstCallback, stream_id, status, &description)); 1377 base::Bind(&NetLogSpdyRstCallback, stream_id, status, &description));
1376 1378
1377 DCHECK(buffered_spdy_framer_.get()); 1379 DCHECK(buffered_spdy_framer_.get());
1378 scoped_ptr<SpdyFrame> rst_frame( 1380 scoped_ptr<SpdySerializedFrame> rst_frame(
1379 buffered_spdy_framer_->CreateRstStream(stream_id, status)); 1381 buffered_spdy_framer_->CreateRstStream(stream_id, status));
1380 1382
1381 EnqueueSessionWrite(priority, RST_STREAM, std::move(rst_frame)); 1383 EnqueueSessionWrite(priority, RST_STREAM, std::move(rst_frame));
1382 RecordProtocolErrorHistogram(MapRstStreamStatusToProtocolError(status)); 1384 RecordProtocolErrorHistogram(MapRstStreamStatusToProtocolError(status));
1383 } 1385 }
1384 1386
1385 void SpdySession::PumpReadLoop(ReadState expected_read_state, int result) { 1387 void SpdySession::PumpReadLoop(ReadState expected_read_state, int result) {
1386 // TODO(bnc): Remove ScopedTracker below once crbug.com/462774 is fixed. 1388 // TODO(bnc): Remove ScopedTracker below once crbug.com/462774 is fixed.
1387 tracked_objects::ScopedTracker tracking_profile( 1389 tracked_objects::ScopedTracker tracking_profile(
1388 FROM_HERE_WITH_EXPLICIT_FUNCTION("462774 SpdySession::PumpReadLoop")); 1390 FROM_HERE_WITH_EXPLICIT_FUNCTION("462774 SpdySession::PumpReadLoop"));
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 // unit-tests would need to be updated. 1768 // unit-tests would need to be updated.
1767 if (err != OK && 1769 if (err != OK &&
1768 err != ERR_ABORTED && // Used by SpdySessionPool to close idle sessions. 1770 err != ERR_ABORTED && // Used by SpdySessionPool to close idle sessions.
1769 err != ERR_NETWORK_CHANGED && // Used to deprecate sessions on IP change. 1771 err != ERR_NETWORK_CHANGED && // Used to deprecate sessions on IP change.
1770 err != ERR_SOCKET_NOT_CONNECTED && err != ERR_HTTP_1_1_REQUIRED && 1772 err != ERR_SOCKET_NOT_CONNECTED && err != ERR_HTTP_1_1_REQUIRED &&
1771 err != ERR_CONNECTION_CLOSED && err != ERR_CONNECTION_RESET) { 1773 err != ERR_CONNECTION_CLOSED && err != ERR_CONNECTION_RESET) {
1772 // Enqueue a GOAWAY to inform the peer of why we're closing the connection. 1774 // Enqueue a GOAWAY to inform the peer of why we're closing the connection.
1773 SpdyGoAwayIR goaway_ir(last_accepted_push_stream_id_, 1775 SpdyGoAwayIR goaway_ir(last_accepted_push_stream_id_,
1774 MapNetErrorToGoAwayStatus(err), 1776 MapNetErrorToGoAwayStatus(err),
1775 description); 1777 description);
1776 EnqueueSessionWrite(HIGHEST, 1778 EnqueueSessionWrite(HIGHEST, GOAWAY,
1777 GOAWAY, 1779 scoped_ptr<SpdySerializedFrame>(new SpdySerializedFrame(
1778 scoped_ptr<SpdyFrame>( 1780 buffered_spdy_framer_->SerializeFrame(goaway_ir))));
1779 buffered_spdy_framer_->SerializeFrame(goaway_ir)));
1780 } 1781 }
1781 1782
1782 availability_state_ = STATE_DRAINING; 1783 availability_state_ = STATE_DRAINING;
1783 error_on_close_ = err; 1784 error_on_close_ = err;
1784 1785
1785 net_log_.AddEvent( 1786 net_log_.AddEvent(
1786 NetLog::TYPE_HTTP2_SESSION_CLOSE, 1787 NetLog::TYPE_HTTP2_SESSION_CLOSE,
1787 base::Bind(&NetLogSpdySessionCloseCallback, err, &description)); 1788 base::Bind(&NetLogSpdySessionCloseCallback, err, &description));
1788 1789
1789 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SpdySession.ClosedOnError", -err); 1790 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.SpdySession.ClosedOnError", -err);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 } 1930 }
1930 1931
1931 UMA_HISTOGRAM_BOOLEAN("Net.SpdySessionSocketNotConnectedGetLocalAddress", 1932 UMA_HISTOGRAM_BOOLEAN("Net.SpdySessionSocketNotConnectedGetLocalAddress",
1932 rv == ERR_SOCKET_NOT_CONNECTED); 1933 rv == ERR_SOCKET_NOT_CONNECTED);
1933 1934
1934 return rv; 1935 return rv;
1935 } 1936 }
1936 1937
1937 void SpdySession::EnqueueSessionWrite(RequestPriority priority, 1938 void SpdySession::EnqueueSessionWrite(RequestPriority priority,
1938 SpdyFrameType frame_type, 1939 SpdyFrameType frame_type,
1939 scoped_ptr<SpdyFrame> frame) { 1940 scoped_ptr<SpdySerializedFrame> frame) {
1940 DCHECK(frame_type == RST_STREAM || frame_type == SETTINGS || 1941 DCHECK(frame_type == RST_STREAM || frame_type == SETTINGS ||
1941 frame_type == WINDOW_UPDATE || frame_type == PING || 1942 frame_type == WINDOW_UPDATE || frame_type == PING ||
1942 frame_type == GOAWAY); 1943 frame_type == GOAWAY);
1943 EnqueueWrite(priority, frame_type, 1944 EnqueueWrite(priority, frame_type,
1944 scoped_ptr<SpdyBufferProducer>(new SimpleBufferProducer( 1945 scoped_ptr<SpdyBufferProducer>(new SimpleBufferProducer(
1945 scoped_ptr<SpdyBuffer>(new SpdyBuffer(std::move(frame))))), 1946 scoped_ptr<SpdyBuffer>(new SpdyBuffer(std::move(frame))))),
1946 base::WeakPtr<SpdyStream>()); 1947 base::WeakPtr<SpdyStream>());
1947 } 1948 }
1948 1949
1949 void SpdySession::EnqueueWrite(RequestPriority priority, 1950 void SpdySession::EnqueueWrite(RequestPriority priority,
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS, 2184 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS,
2184 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(), 2185 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(),
2185 clear_persisted)); 2186 clear_persisted));
2186 } 2187 }
2187 2188
2188 if (GetProtocolVersion() >= HTTP2) { 2189 if (GetProtocolVersion() >= HTTP2) {
2189 // Send an acknowledgment of the setting. 2190 // Send an acknowledgment of the setting.
2190 SpdySettingsIR settings_ir; 2191 SpdySettingsIR settings_ir;
2191 settings_ir.set_is_ack(true); 2192 settings_ir.set_is_ack(true);
2192 EnqueueSessionWrite( 2193 EnqueueSessionWrite(
2193 HIGHEST, 2194 HIGHEST, SETTINGS,
2194 SETTINGS, 2195 scoped_ptr<SpdySerializedFrame>(new SpdySerializedFrame(
2195 scoped_ptr<SpdyFrame>( 2196 buffered_spdy_framer_->SerializeFrame(settings_ir))));
2196 buffered_spdy_framer_->SerializeFrame(settings_ir)));
2197 } 2197 }
2198 } 2198 }
2199 2199
2200 void SpdySession::OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) { 2200 void SpdySession::OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) {
2201 CHECK(in_io_loop_); 2201 CHECK(in_io_loop_);
2202 2202
2203 HandleSetting(id, value); 2203 HandleSetting(id, value);
2204 http_server_properties_->SetSpdySetting( 2204 http_server_properties_->SetSpdySetting(
2205 host_port_pair(), 2205 host_port_pair(),
2206 id, 2206 id,
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2821 CHECK_EQ(it->second.stream->stream_id(), stream_id); 2821 CHECK_EQ(it->second.stream->stream_id(), stream_id);
2822 SendWindowUpdateFrame( 2822 SendWindowUpdateFrame(
2823 stream_id, delta_window_size, it->second.stream->priority()); 2823 stream_id, delta_window_size, it->second.stream->priority());
2824 } 2824 }
2825 2825
2826 void SpdySession::SendInitialData() { 2826 void SpdySession::SendInitialData() {
2827 DCHECK(enable_sending_initial_data_); 2827 DCHECK(enable_sending_initial_data_);
2828 2828
2829 if (send_connection_header_prefix_) { 2829 if (send_connection_header_prefix_) {
2830 DCHECK_EQ(protocol_, kProtoHTTP2); 2830 DCHECK_EQ(protocol_, kProtoHTTP2);
2831 scoped_ptr<SpdyFrame> connection_header_prefix_frame( 2831 scoped_ptr<SpdySerializedFrame> connection_header_prefix_frame(
2832 new SpdyFrame(const_cast<char*>(kHttp2ConnectionHeaderPrefix), 2832 new SpdySerializedFrame(const_cast<char*>(kHttp2ConnectionHeaderPrefix),
2833 kHttp2ConnectionHeaderPrefixSize, 2833 kHttp2ConnectionHeaderPrefixSize,
2834 false /* take_ownership */)); 2834 false /* take_ownership */));
2835 // Count the prefix as part of the subsequent SETTINGS frame. 2835 // Count the prefix as part of the subsequent SETTINGS frame.
2836 EnqueueSessionWrite(HIGHEST, SETTINGS, 2836 EnqueueSessionWrite(HIGHEST, SETTINGS,
2837 std::move(connection_header_prefix_frame)); 2837 std::move(connection_header_prefix_frame));
2838 } 2838 }
2839 2839
2840 // First, notify the server about the settings they should use when 2840 // First, notify the server about the settings they should use when
2841 // communicating with us. 2841 // communicating with us.
2842 SettingsMap settings_map; 2842 SettingsMap settings_map;
2843 // Create a new settings frame notifying the server of our 2843 // Create a new settings frame notifying the server of our
2844 // max concurrent streams and initial window size. 2844 // max concurrent streams and initial window size.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2889 } 2889 }
2890 2890
2891 2891
2892 void SpdySession::SendSettings(const SettingsMap& settings) { 2892 void SpdySession::SendSettings(const SettingsMap& settings) {
2893 const SpdyMajorVersion protocol_version = GetProtocolVersion(); 2893 const SpdyMajorVersion protocol_version = GetProtocolVersion();
2894 net_log_.AddEvent( 2894 net_log_.AddEvent(
2895 NetLog::TYPE_HTTP2_SESSION_SEND_SETTINGS, 2895 NetLog::TYPE_HTTP2_SESSION_SEND_SETTINGS,
2896 base::Bind(&NetLogSpdySendSettingsCallback, &settings, protocol_version)); 2896 base::Bind(&NetLogSpdySendSettingsCallback, &settings, protocol_version));
2897 // Create the SETTINGS frame and send it. 2897 // Create the SETTINGS frame and send it.
2898 DCHECK(buffered_spdy_framer_.get()); 2898 DCHECK(buffered_spdy_framer_.get());
2899 scoped_ptr<SpdyFrame> settings_frame( 2899 scoped_ptr<SpdySerializedFrame> settings_frame(
2900 buffered_spdy_framer_->CreateSettings(settings)); 2900 buffered_spdy_framer_->CreateSettings(settings));
2901 sent_settings_ = true; 2901 sent_settings_ = true;
2902 EnqueueSessionWrite(HIGHEST, SETTINGS, std::move(settings_frame)); 2902 EnqueueSessionWrite(HIGHEST, SETTINGS, std::move(settings_frame));
2903 } 2903 }
2904 2904
2905 void SpdySession::HandleSetting(uint32_t id, uint32_t value) { 2905 void SpdySession::HandleSetting(uint32_t id, uint32_t value) {
2906 switch (id) { 2906 switch (id) {
2907 case SETTINGS_MAX_CONCURRENT_STREAMS: 2907 case SETTINGS_MAX_CONCURRENT_STREAMS:
2908 max_concurrent_streams_ = std::min(static_cast<size_t>(value), 2908 max_concurrent_streams_ = std::min(static_cast<size_t>(value),
2909 kMaxConcurrentStreamLimit); 2909 kMaxConcurrentStreamLimit);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2964 CHECK_EQ(it->second.stream->stream_id(), stream_id); 2964 CHECK_EQ(it->second.stream->stream_id(), stream_id);
2965 } else { 2965 } else {
2966 CHECK_EQ(stream_id, kSessionFlowControlStreamId); 2966 CHECK_EQ(stream_id, kSessionFlowControlStreamId);
2967 } 2967 }
2968 2968
2969 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_SENT_WINDOW_UPDATE_FRAME, 2969 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_SENT_WINDOW_UPDATE_FRAME,
2970 base::Bind(&NetLogSpdyWindowUpdateFrameCallback, stream_id, 2970 base::Bind(&NetLogSpdyWindowUpdateFrameCallback, stream_id,
2971 delta_window_size)); 2971 delta_window_size));
2972 2972
2973 DCHECK(buffered_spdy_framer_.get()); 2973 DCHECK(buffered_spdy_framer_.get());
2974 scoped_ptr<SpdyFrame> window_update_frame( 2974 scoped_ptr<SpdySerializedFrame> window_update_frame(
2975 buffered_spdy_framer_->CreateWindowUpdate(stream_id, delta_window_size)); 2975 buffered_spdy_framer_->CreateWindowUpdate(stream_id, delta_window_size));
2976 EnqueueSessionWrite(priority, WINDOW_UPDATE, std::move(window_update_frame)); 2976 EnqueueSessionWrite(priority, WINDOW_UPDATE, std::move(window_update_frame));
2977 } 2977 }
2978 2978
2979 void SpdySession::WritePingFrame(SpdyPingId unique_id, bool is_ack) { 2979 void SpdySession::WritePingFrame(SpdyPingId unique_id, bool is_ack) {
2980 DCHECK(buffered_spdy_framer_.get()); 2980 DCHECK(buffered_spdy_framer_.get());
2981 scoped_ptr<SpdyFrame> ping_frame( 2981 scoped_ptr<SpdySerializedFrame> ping_frame(
2982 buffered_spdy_framer_->CreatePingFrame(unique_id, is_ack)); 2982 buffered_spdy_framer_->CreatePingFrame(unique_id, is_ack));
2983 EnqueueSessionWrite(HIGHEST, PING, std::move(ping_frame)); 2983 EnqueueSessionWrite(HIGHEST, PING, std::move(ping_frame));
2984 2984
2985 if (net_log().IsCapturing()) { 2985 if (net_log().IsCapturing()) {
2986 net_log().AddEvent( 2986 net_log().AddEvent(
2987 NetLog::TYPE_HTTP2_SESSION_PING, 2987 NetLog::TYPE_HTTP2_SESSION_PING,
2988 base::Bind(&NetLogSpdyPingCallback, unique_id, is_ack, "sent")); 2988 base::Bind(&NetLogSpdyPingCallback, unique_id, is_ack, "sent"));
2989 } 2989 }
2990 if (!is_ack) { 2990 if (!is_ack) {
2991 next_ping_id_ += 2; 2991 next_ping_id_ += 2;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 if (!queue->empty()) { 3306 if (!queue->empty()) {
3307 SpdyStreamId stream_id = queue->front(); 3307 SpdyStreamId stream_id = queue->front();
3308 queue->pop_front(); 3308 queue->pop_front();
3309 return stream_id; 3309 return stream_id;
3310 } 3310 }
3311 } 3311 }
3312 return 0; 3312 return 0;
3313 } 3313 }
3314 3314
3315 } // namespace net 3315 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698