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

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

Issue 1866983006: SHP 2: Change SpdySettingsMap to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SHP_1
Patch Set: remove commented line 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_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 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 NOTREACHED(); 2031 NOTREACHED();
2032 return base::WeakPtr<SpdyStream>(); 2032 return base::WeakPtr<SpdyStream>();
2033 } 2033 }
2034 2034
2035 net_log_.AddEvent(NetLog::TYPE_HTTP2_STREAM_ADOPTED_PUSH_STREAM, 2035 net_log_.AddEvent(NetLog::TYPE_HTTP2_STREAM_ADOPTED_PUSH_STREAM,
2036 base::Bind(&NetLogSpdyAdoptedPushStreamCallback, 2036 base::Bind(&NetLogSpdyAdoptedPushStreamCallback,
2037 active_it->second.stream->stream_id(), &url)); 2037 active_it->second.stream->stream_id(), &url));
2038 return active_it->second.stream->GetWeakPtr(); 2038 return active_it->second.stream->GetWeakPtr();
2039 } 2039 }
2040 2040
2041 url::SchemeHostPort SpdySession::GetServer() {
2042 return url::SchemeHostPort(is_secure_ ? "https" : "http",
Zhongyi Shi 2016/04/12 21:08:08 Need confirm: is that safe to use is_secure_ inste
Ryan Hamilton 2016/04/13 04:13:24 Looks great!
2043 host_port_pair().host(),
2044 host_port_pair().port());
2045 }
2046
2041 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info, 2047 bool SpdySession::GetSSLInfo(SSLInfo* ssl_info,
2042 bool* was_npn_negotiated, 2048 bool* was_npn_negotiated,
2043 NextProto* protocol_negotiated) { 2049 NextProto* protocol_negotiated) {
2044 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated(); 2050 *was_npn_negotiated = connection_->socket()->WasNpnNegotiated();
2045 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol(); 2051 *protocol_negotiated = connection_->socket()->GetNegotiatedProtocol();
2046 return connection_->socket()->GetSSLInfo(ssl_info); 2052 return connection_->socket()->GetSSLInfo(ssl_info);
2047 } 2053 }
2048 2054
2049 Error SpdySession::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, 2055 Error SpdySession::GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key,
2050 std::vector<uint8_t>* out) { 2056 std::vector<uint8_t>* out) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 } 2183 }
2178 2184
2179 void SpdySession::OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) { 2185 void SpdySession::OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) {
2180 LOG(FATAL); 2186 LOG(FATAL);
2181 } 2187 }
2182 2188
2183 void SpdySession::OnSettings(bool clear_persisted) { 2189 void SpdySession::OnSettings(bool clear_persisted) {
2184 CHECK(in_io_loop_); 2190 CHECK(in_io_loop_);
2185 2191
2186 if (clear_persisted) 2192 if (clear_persisted)
2187 http_server_properties_->ClearSpdySettings(host_port_pair()); 2193 http_server_properties_->ClearSpdySettings(GetServer());
2188 2194
2189 if (net_log_.IsCapturing()) { 2195 if (net_log_.IsCapturing()) {
2190 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS, 2196 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTINGS,
2191 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(), 2197 base::Bind(&NetLogSpdySettingsCallback, host_port_pair(),
2192 clear_persisted)); 2198 clear_persisted));
2193 } 2199 }
2194 2200
2195 if (GetProtocolVersion() >= HTTP2) { 2201 if (GetProtocolVersion() >= HTTP2) {
2196 // Send an acknowledgment of the setting. 2202 // Send an acknowledgment of the setting.
2197 SpdySettingsIR settings_ir; 2203 SpdySettingsIR settings_ir;
2198 settings_ir.set_is_ack(true); 2204 settings_ir.set_is_ack(true);
2199 EnqueueSessionWrite( 2205 EnqueueSessionWrite(
2200 HIGHEST, SETTINGS, 2206 HIGHEST, SETTINGS,
2201 scoped_ptr<SpdySerializedFrame>(new SpdySerializedFrame( 2207 scoped_ptr<SpdySerializedFrame>(new SpdySerializedFrame(
2202 buffered_spdy_framer_->SerializeFrame(settings_ir)))); 2208 buffered_spdy_framer_->SerializeFrame(settings_ir))));
2203 } 2209 }
2204 } 2210 }
2205 2211
2206 void SpdySession::OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) { 2212 void SpdySession::OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) {
2207 CHECK(in_io_loop_); 2213 CHECK(in_io_loop_);
2208 2214
2209 HandleSetting(id, value); 2215 HandleSetting(id, value);
2210 http_server_properties_->SetSpdySetting( 2216 http_server_properties_->SetSpdySetting(
2211 host_port_pair(), 2217 GetServer(),
2212 id, 2218 id,
2213 static_cast<SpdySettingsFlags>(flags), 2219 static_cast<SpdySettingsFlags>(flags),
2214 value); 2220 value);
2215 received_settings_ = true; 2221 received_settings_ = true;
2216 2222
2217 // Log the setting. 2223 // Log the setting.
2218 const SpdyMajorVersion protocol_version = GetProtocolVersion(); 2224 const SpdyMajorVersion protocol_version = GetProtocolVersion();
2219 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTING, 2225 net_log_.AddEvent(NetLog::TYPE_HTTP2_SESSION_RECV_SETTING,
2220 base::Bind(&NetLogSpdySettingCallback, id, protocol_version, 2226 base::Bind(&NetLogSpdySettingCallback, id, protocol_version,
2221 static_cast<SpdySettingsFlags>(flags), value)); 2227 static_cast<SpdySettingsFlags>(flags), value));
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 if (session_max_recv_window_size_ > session_recv_window_size_) { 2873 if (session_max_recv_window_size_ > session_recv_window_size_) {
2868 IncreaseRecvWindowSize(session_max_recv_window_size_ - 2874 IncreaseRecvWindowSize(session_max_recv_window_size_ -
2869 session_recv_window_size_); 2875 session_recv_window_size_);
2870 } 2876 }
2871 2877
2872 if (protocol_ == kProtoSPDY31) { 2878 if (protocol_ == kProtoSPDY31) {
2873 // Finally, notify the server about the settings they have 2879 // Finally, notify the server about the settings they have
2874 // previously told us to use when communicating with them (after 2880 // previously told us to use when communicating with them (after
2875 // applying them). 2881 // applying them).
2876 const SettingsMap& server_settings_map = 2882 const SettingsMap& server_settings_map =
2877 http_server_properties_->GetSpdySettings(host_port_pair()); 2883 http_server_properties_->GetSpdySettings(GetServer());
2878 if (server_settings_map.empty()) 2884 if (server_settings_map.empty())
2879 return; 2885 return;
2880 2886
2881 SettingsMap::const_iterator it = 2887 SettingsMap::const_iterator it =
2882 server_settings_map.find(SETTINGS_CURRENT_CWND); 2888 server_settings_map.find(SETTINGS_CURRENT_CWND);
2883 uint32_t cwnd = (it != server_settings_map.end()) ? it->second.second : 0; 2889 uint32_t cwnd = (it != server_settings_map.end()) ? it->second.second : 0;
2884 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", cwnd, 1, 200, 100); 2890 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", cwnd, 1, 200, 100);
2885 2891
2886 for (SettingsMap::const_iterator it = server_settings_map.begin(); 2892 for (SettingsMap::const_iterator it = server_settings_map.begin();
2887 it != server_settings_map.end(); ++it) { 2893 it != server_settings_map.end(); ++it) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 received_settings_ ? 1 : 0, 2); 3080 received_settings_ ? 1 : 0, 2);
3075 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamStallsPerSession", 3081 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdyStreamStallsPerSession",
3076 stalled_streams_, 3082 stalled_streams_,
3077 0, 300, 50); 3083 0, 300, 50);
3078 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionsWithStalls", 3084 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionsWithStalls",
3079 stalled_streams_ > 0 ? 1 : 0, 2); 3085 stalled_streams_ > 0 ? 1 : 0, 2);
3080 3086
3081 if (received_settings_) { 3087 if (received_settings_) {
3082 // Enumerate the saved settings, and set histograms for it. 3088 // Enumerate the saved settings, and set histograms for it.
3083 const SettingsMap& settings_map = 3089 const SettingsMap& settings_map =
3084 http_server_properties_->GetSpdySettings(host_port_pair()); 3090 http_server_properties_->GetSpdySettings(GetServer());
3085 3091
3086 SettingsMap::const_iterator it; 3092 SettingsMap::const_iterator it;
3087 for (it = settings_map.begin(); it != settings_map.end(); ++it) { 3093 for (it = settings_map.begin(); it != settings_map.end(); ++it) {
3088 const SpdySettingsIds id = it->first; 3094 const SpdySettingsIds id = it->first;
3089 const uint32_t val = it->second.second; 3095 const uint32_t val = it->second.second;
3090 switch (id) { 3096 switch (id) {
3091 case SETTINGS_CURRENT_CWND: 3097 case SETTINGS_CURRENT_CWND:
3092 // Record several different histograms to see if cwnd converges 3098 // Record several different histograms to see if cwnd converges
3093 // for larger volumes of data being sent. 3099 // for larger volumes of data being sent.
3094 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd", 3100 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwnd",
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
3312 if (!queue->empty()) { 3318 if (!queue->empty()) {
3313 SpdyStreamId stream_id = queue->front(); 3319 SpdyStreamId stream_id = queue->front();
3314 queue->pop_front(); 3320 queue->pop_front();
3315 return stream_id; 3321 return stream_id;
3316 } 3322 }
3317 } 3323 }
3318 return 0; 3324 return 0;
3319 } 3325 }
3320 3326
3321 } // namespace net 3327 } // 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