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

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

Issue 1904483004: Change SupportsSpdy dict, SpdySettingsMap, ServerNetworkStatsMap, AlternativeServiceMap and disk da… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format net 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
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 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 NOTREACHED(); 2038 NOTREACHED();
2039 return base::WeakPtr<SpdyStream>(); 2039 return base::WeakPtr<SpdyStream>();
2040 } 2040 }
2041 2041
2042 net_log_.AddEvent(NetLog::TYPE_HTTP2_STREAM_ADOPTED_PUSH_STREAM, 2042 net_log_.AddEvent(NetLog::TYPE_HTTP2_STREAM_ADOPTED_PUSH_STREAM,
2043 base::Bind(&NetLogSpdyAdoptedPushStreamCallback, 2043 base::Bind(&NetLogSpdyAdoptedPushStreamCallback,
2044 active_it->second.stream->stream_id(), &url)); 2044 active_it->second.stream->stream_id(), &url));
2045 return active_it->second.stream->GetWeakPtr(); 2045 return active_it->second.stream->GetWeakPtr();
2046 } 2046 }
2047 2047
2048 url::SchemeHostPort SpdySession::GetServer() {
2049 return url::SchemeHostPort(is_secure_ ? "https" : "http",
2050 host_port_pair().host(), host_port_pair().port());
2051 }
2052
2048 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, 2053 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info,
2049 bool* was_npn_negotiated, 2054 bool* was_npn_negotiated,
2050 NextProto* protocol_negotiated) { 2055 NextProto* protocol_negotiated) {
2051 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); 2056 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated();
2052 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); 2057 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol();
2053 return connection_->socket()->GetSSLInfo(ssl_info); 2058 return connection_->socket()->GetSSLInfo(ssl_info);
2054 } 2059 }
2055 2060
2056 Error SpdySession::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, 2061 Error SpdySession::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key,
2057 std::vector<uint8_t>* out) { 2062 std::vector<uint8_t>* out) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 } 2189 }
2185 2190
2186 void SpdySession::OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) { 2191 void SpdySession::OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) {
2187 LOG(FATAL); 2192 LOG(FATAL);
2188 } 2193 }
2189 2194
2190 void SpdySession::OnSettings(bool clear_persisted) { 2195 void SpdySession::OnSettings(bool clear_persisted) {
2191 CHECK(in_io_loop_); 2196 CHECK(in_io_loop_);
2192 2197
2193 if (clear_persisted) 2198 if (clear_persisted)
2194 http_server_properties_->ClearSpdySettings(host_port_pair()); 2199 http_server_properties_->ClearSpdySettings(GetServer());
2195 2200
2196 if (net_log_.IsCapturing()) { 2201 if (net_log_.IsCapturing()) {
2197 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS, 2202 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS,
2198 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(), 2203 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(),
2199 clear_persisted)); 2204 clear_persisted));
2200 } 2205 }
2201 2206
2202 if (GetProtocolVersion() >= HTTP2) { 2207 if (GetProtocolVersion() >= HTTP2) {
2203 // Send an acknowledgment of the setting. 2208 // Send an acknowledgment of the setting.
2204 SpdySettingsIR settings_ir; 2209 SpdySettingsIR settings_ir;
2205 settings_ir.set_is_ack(true); 2210 settings_ir.set_is_ack(true);
2206 EnqueueSessionWrite( 2211 EnqueueSessionWrite(
2207 HIGHEST, SETTINGS, 2212 HIGHEST, SETTINGS,
2208 std::unique_ptr<SpdySerializedFrame>(new SpdySerializedFrame( 2213 std::unique_ptr<SpdySerializedFrame>(new SpdySerializedFrame(
2209 buffered_spdy_framer_->SerializeFrame(settings_ir)))); 2214 buffered_spdy_framer_->SerializeFrame(settings_ir))));
2210 } 2215 }
2211 } 2216 }
2212 2217
2213 void SpdySession::OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) { 2218 void SpdySession::OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) {
2214 CHECK(in_io_loop_); 2219 CHECK(in_io_loop_);
2215 2220
2216 HandleSetting(id, value); 2221 HandleSetting(id, value);
2217 http_server_properties_->SetSpdySetting( 2222 http_server_properties_->SetSpdySetting(
2218 host_port_pair(), 2223 GetServer(), id, static_cast<SpdySettingsFlags>(flags), value);
2219 id,
2220 static_cast<SpdySettingsFlags>(flags),
2221 value);
2222 received_settings_ = true; 2224 received_settings_ = true;
2223 2225
2224 // Log the setting. 2226 // Log the setting.
2225 const SpdyMajorVersion protocol_version = GetProtocolVersion(); 2227 const SpdyMajorVersion protocol_version = GetProtocolVersion();
2226 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTING, 2228 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTING,
2227 base::Bind(&NetLogSpdySettingCallback, id, protocol_version, 2229 base::Bind(&NetLogSpdySettingCallback, id, protocol_version,
2228 static_cast<SpdySettingsFlags>(flags), value)); 2230 static_cast<SpdySettingsFlags>(flags), value));
2229 } 2231 }
2230 2232
2231 void SpdySession::OnSendCompressedFrame( 2233 void SpdySession::OnSendCompressedFrame(
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 if (session_max_recv_window_size_ > session_recv_window_size_) { 2876 if (session_max_recv_window_size_ > session_recv_window_size_) {
2875 IncreaseRecvWindowSize(session_max_recv_window_size_ - 2877 IncreaseRecvWindowSize(session_max_recv_window_size_ -
2876 session_recv_window_size_); 2878 session_recv_window_size_);
2877 } 2879 }
2878 2880
2879 if (protocol_ == kProtoSPDY31) { 2881 if (protocol_ == kProtoSPDY31) {
2880 // Finally, notify the server about the settings they have 2882 // Finally, notify the server about the settings they have
2881 // previously told us to use when communicating with them (after 2883 // previously told us to use when communicating with them (after
2882 // applying them). 2884 // applying them).
2883 const SettingsMap& server_settings_map = 2885 const SettingsMap& server_settings_map =
2884 http_server_properties_->GetSpdySettings(host_port_pair()); 2886 http_server_properties_->GetSpdySettings(GetServer());
2885 if (server_settings_map.empty()) 2887 if (server_settings_map.empty())
2886 return; 2888 return;
2887 2889
2888 SettingsMap::const_iterator it = 2890 SettingsMap::const_iterator it =
2889 server_settings_map.find(SETTINGS_CURRENT_CWND); 2891 server_settings_map.find(SETTINGS_CURRENT_CWND);
2890 uint32_t cwnd = (it != server_settings_map.end()) ? it->second.second : 0; 2892 uint32_t cwnd = (it != server_settings_map.end()) ? it->second.second : 0;
2891 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", cwnd, 1, 200, 100); 2893 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", cwnd, 1, 200, 100);
2892 2894
2893 for (SettingsMap::const_iterator it = server_settings_map.begin(); 2895 for (SettingsMap::const_iterator it = server_settings_map.begin();
2894 it != server_settings_map.end(); ++it) { 2896 it != server_settings_map.end(); ++it) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3081 received_settings_ ? 1 : 0, 2); 3083 received_settings_ ? 1 : 0, 2);
3082 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamStallsPerSession", 3084 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamStallsPerSession",
3083 stalled_streams_, 3085 stalled_streams_,
3084 0, 300, 50); 3086 0, 300, 50);
3085 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionsWithStalls", 3087 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionsWithStalls",
3086 stalled_streams_ > 0 ? 1 : 0, 2); 3088 stalled_streams_ > 0 ? 1 : 0, 2);
3087 3089
3088 if (received_settings_) { 3090 if (received_settings_) {
3089 // Enumerate the saved settings, and set histograms for it. 3091 // Enumerate the saved settings, and set histograms for it.
3090 const SettingsMap& settings_map = 3092 const SettingsMap& settings_map =
3091 http_server_properties_->GetSpdySettings(host_port_pair()); 3093 http_server_properties_->GetSpdySettings(GetServer());
3092 3094
3093 SettingsMap::const_iterator it; 3095 SettingsMap::const_iterator it;
3094 for (it = settings_map.begin(); it != settings_map.end(); ++it) { 3096 for (it = settings_map.begin(); it != settings_map.end(); ++it) {
3095 const SpdySettingsIds id = it->first; 3097 const SpdySettingsIds id = it->first;
3096 const uint32_t val = it->second.second; 3098 const uint32_t val = it->second.second;
3097 switch (id) { 3099 switch (id) {
3098 case SETTINGS_CURRENT_CWND: 3100 case SETTINGS_CURRENT_CWND:
3099 // Record several different histograms to see if cwnd converges 3101 // Record several different histograms to see if cwnd converges
3100 // for larger volumes of data being sent. 3102 // for larger volumes of data being sent.
3101 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd", 3103 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd",
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3319 if (!queue->empty()) { 3321 if (!queue->empty()) {
3320 SpdyStreamId stream_id = queue->front(); 3322 SpdyStreamId stream_id = queue->front();
3321 queue->pop_front(); 3323 queue->pop_front();
3322 return stream_id; 3324 return stream_id;
3323 } 3325 }
3324 } 3326 }
3325 return 0; 3327 return 0;
3326 } 3328 }
3327 3329
3328 } // namespace net 3330 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698