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

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

Issue 1779733003: Fix bug in net::RequestPriority -> HTTP/2 dependency conversion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate Bence's detailed comments. Created 4 years, 9 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 #ifndef NET_SPDY_SPDY_SESSION_H_ 5 #ifndef NET_SPDY_SPDY_SESSION_H_
6 #define NET_SPDY_SPDY_SESSION_H_ 6 #define NET_SPDY_SPDY_SESSION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "net/base/load_states.h" 24 #include "net/base/load_states.h"
25 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
26 #include "net/base/net_export.h" 26 #include "net/base/net_export.h"
27 #include "net/base/request_priority.h" 27 #include "net/base/request_priority.h"
28 #include "net/socket/client_socket_handle.h" 28 #include "net/socket/client_socket_handle.h"
29 #include "net/socket/client_socket_pool.h" 29 #include "net/socket/client_socket_pool.h"
30 #include "net/socket/next_proto.h" 30 #include "net/socket/next_proto.h"
31 #include "net/socket/ssl_client_socket.h" 31 #include "net/socket/ssl_client_socket.h"
32 #include "net/socket/stream_socket.h" 32 #include "net/socket/stream_socket.h"
33 #include "net/spdy/buffered_spdy_framer.h" 33 #include "net/spdy/buffered_spdy_framer.h"
34 #include "net/spdy/http2_priority_dependencies.h"
34 #include "net/spdy/spdy_buffer.h" 35 #include "net/spdy/spdy_buffer.h"
35 #include "net/spdy/spdy_framer.h" 36 #include "net/spdy/spdy_framer.h"
36 #include "net/spdy/spdy_header_block.h" 37 #include "net/spdy/spdy_header_block.h"
37 #include "net/spdy/spdy_protocol.h" 38 #include "net/spdy/spdy_protocol.h"
38 #include "net/spdy/spdy_session_pool.h" 39 #include "net/spdy/spdy_session_pool.h"
39 #include "net/spdy/spdy_stream.h" 40 #include "net/spdy/spdy_stream.h"
40 #include "net/spdy/spdy_write_queue.h" 41 #include "net/spdy/spdy_write_queue.h"
41 #include "net/ssl/ssl_config_service.h" 42 #include "net/ssl/ssl_config_service.h"
42 #include "url/gurl.h" 43 #include "url/gurl.h"
43 44
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // |spdy_session_key| is the host/port that this session connects to, privacy 235 // |spdy_session_key| is the host/port that this session connects to, privacy
235 // and proxy configuration settings that it's using. 236 // and proxy configuration settings that it's using.
236 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log 237 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log
237 // network events to. 238 // network events to.
238 SpdySession(const SpdySessionKey& spdy_session_key, 239 SpdySession(const SpdySessionKey& spdy_session_key,
239 const base::WeakPtr<HttpServerProperties>& http_server_properties, 240 const base::WeakPtr<HttpServerProperties>& http_server_properties,
240 TransportSecurityState* transport_security_state, 241 TransportSecurityState* transport_security_state,
241 bool verify_domain_authentication, 242 bool verify_domain_authentication,
242 bool enable_sending_initial_data, 243 bool enable_sending_initial_data,
243 bool enable_ping_based_connection_checking, 244 bool enable_ping_based_connection_checking,
245 bool enable_priority_dependencies,
244 NextProto default_protocol, 246 NextProto default_protocol,
245 size_t session_max_recv_window_size, 247 size_t session_max_recv_window_size,
246 size_t stream_max_recv_window_size, 248 size_t stream_max_recv_window_size,
247 TimeFunc time_func, 249 TimeFunc time_func,
248 ProxyDelegate* proxy_delegate, 250 ProxyDelegate* proxy_delegate,
249 NetLog* net_log); 251 NetLog* net_log);
250 252
251 ~SpdySession() override; 253 ~SpdySession() override;
252 254
253 const HostPortPair& host_port_pair() const { 255 const HostPortPair& host_port_pair() const {
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 } 954 }
953 955
954 int64_t pings_in_flight() const { return pings_in_flight_; } 956 int64_t pings_in_flight() const { return pings_in_flight_; }
955 957
956 SpdyPingId next_ping_id() const { return next_ping_id_; } 958 SpdyPingId next_ping_id() const { return next_ping_id_; }
957 959
958 base::TimeTicks last_activity_time() const { return last_activity_time_; } 960 base::TimeTicks last_activity_time() const { return last_activity_time_; }
959 961
960 bool check_ping_status_pending() const { return check_ping_status_pending_; } 962 bool check_ping_status_pending() const { return check_ping_status_pending_; }
961 963
962 // Set whether priority->dependency conversion is enabled
963 // by default for all future SpdySessions.
964 static void SetPriorityDependencyDefaultForTesting(bool enable);
965
966 // Whether Do{Read,Write}Loop() is in the call stack. Useful for 964 // Whether Do{Read,Write}Loop() is in the call stack. Useful for
967 // making sure we don't destroy ourselves prematurely in that case. 965 // making sure we don't destroy ourselves prematurely in that case.
968 bool in_io_loop_; 966 bool in_io_loop_;
969 967
970 // The key used to identify this session. 968 // The key used to identify this session.
971 const SpdySessionKey spdy_session_key_; 969 const SpdySessionKey spdy_session_key_;
972 970
973 // Set set of SpdySessionKeys for which this session has serviced 971 // Set set of SpdySessionKeys for which this session has serviced
974 // requests. 972 // requests.
975 std::set<SpdySessionKey> pooled_aliases_; 973 std::set<SpdySessionKey> pooled_aliases_;
(...skipping 26 matching lines...) Expand all
1002 // the server to start pushing the stream]) or there are still network events 1000 // the server to start pushing the stream]) or there are still network events
1003 // incoming even though the consumer has already gone away (cancellation). 1001 // incoming even though the consumer has already gone away (cancellation).
1004 // 1002 //
1005 // |active_streams_| owns all its SpdyStream objects. 1003 // |active_streams_| owns all its SpdyStream objects.
1006 // 1004 //
1007 // TODO(willchan): Perhaps we should separate out cancelled streams and move 1005 // TODO(willchan): Perhaps we should separate out cancelled streams and move
1008 // them into a separate ActiveStreamMap, and not deliver network events to 1006 // them into a separate ActiveStreamMap, and not deliver network events to
1009 // them? 1007 // them?
1010 ActiveStreamMap active_streams_; 1008 ActiveStreamMap active_streams_;
1011 1009
1012 // Per-priority map from stream id to all active streams. This map will
1013 // contain the same set of streams as |active_streams_|. It is used for
1014 // setting dependencies to match incoming requests RequestPriority.
1015 //
1016 // |active_streams_by_priority_| does *not* own its SpdyStream objects.
1017 std::map<SpdyStreamId, SpdyStream*>
1018 active_streams_by_priority_[NUM_PRIORITIES];
1019
1020 // (Bijective) map from the URL to the ID of the streams that have 1010 // (Bijective) map from the URL to the ID of the streams that have
1021 // already started to be pushed by the server, but do not have 1011 // already started to be pushed by the server, but do not have
1022 // consumers yet. Contains a subset of |active_streams_|. 1012 // consumers yet. Contains a subset of |active_streams_|.
1023 PushedStreamMap unclaimed_pushed_streams_; 1013 PushedStreamMap unclaimed_pushed_streams_;
1024 1014
1025 // Set of all created streams but that have not yet sent any frames. 1015 // Set of all created streams but that have not yet sent any frames.
1026 // 1016 //
1027 // |created_streams_| owns all its SpdyStream objects. 1017 // |created_streams_| owns all its SpdyStream objects.
1028 CreatedStreamSet created_streams_; 1018 CreatedStreamSet created_streams_;
1029 1019
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 // get a PING response (http://crbug.com/127812). 1175 // get a PING response (http://crbug.com/127812).
1186 base::TimeDelta hung_interval_; 1176 base::TimeDelta hung_interval_;
1187 1177
1188 // The |proxy_delegate_| verifies that a given proxy is a trusted SPDY proxy, 1178 // The |proxy_delegate_| verifies that a given proxy is a trusted SPDY proxy,
1189 // which is allowed to push resources from origins that are different from 1179 // which is allowed to push resources from origins that are different from
1190 // those of their associated streams. May be nullptr. 1180 // those of their associated streams. May be nullptr.
1191 ProxyDelegate* proxy_delegate_; 1181 ProxyDelegate* proxy_delegate_;
1192 1182
1193 TimeFunc time_func_; 1183 TimeFunc time_func_;
1194 1184
1195 // Should priority-based dependency information be sent in stream header 1185 const bool priority_dependencies_enabled_;
1196 // frames. 1186 Http2PriorityDependencies priority_dependency_state_;
1197 bool send_priority_dependency_;
1198 1187
1199 // Used for posting asynchronous IO tasks. We use this even though 1188 // Used for posting asynchronous IO tasks. We use this even though
1200 // SpdySession is refcounted because we don't need to keep the SpdySession 1189 // SpdySession is refcounted because we don't need to keep the SpdySession
1201 // alive if the last reference is within a RunnableMethod. Just revoke the 1190 // alive if the last reference is within a RunnableMethod. Just revoke the
1202 // method. 1191 // method.
1203 base::WeakPtrFactory<SpdySession> weak_factory_; 1192 base::WeakPtrFactory<SpdySession> weak_factory_;
1204 }; 1193 };
1205 1194
1206 } // namespace net 1195 } // namespace net
1207 1196
1208 #endif // NET_SPDY_SPDY_SESSION_H_ 1197 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698