| 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 #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 14 matching lines...) Expand all Loading... |
| 25 #include "net/base/load_states.h" | 25 #include "net/base/load_states.h" |
| 26 #include "net/base/net_errors.h" | 26 #include "net/base/net_errors.h" |
| 27 #include "net/base/net_export.h" | 27 #include "net/base/net_export.h" |
| 28 #include "net/base/request_priority.h" | 28 #include "net/base/request_priority.h" |
| 29 #include "net/socket/client_socket_handle.h" | 29 #include "net/socket/client_socket_handle.h" |
| 30 #include "net/socket/client_socket_pool.h" | 30 #include "net/socket/client_socket_pool.h" |
| 31 #include "net/socket/next_proto.h" | 31 #include "net/socket/next_proto.h" |
| 32 #include "net/socket/ssl_client_socket.h" | 32 #include "net/socket/ssl_client_socket.h" |
| 33 #include "net/socket/stream_socket.h" | 33 #include "net/socket/stream_socket.h" |
| 34 #include "net/spdy/buffered_spdy_framer.h" | 34 #include "net/spdy/buffered_spdy_framer.h" |
| 35 #include "net/spdy/http2_priority_dependencies.h" |
| 35 #include "net/spdy/spdy_buffer.h" | 36 #include "net/spdy/spdy_buffer.h" |
| 36 #include "net/spdy/spdy_framer.h" | 37 #include "net/spdy/spdy_framer.h" |
| 37 #include "net/spdy/spdy_header_block.h" | 38 #include "net/spdy/spdy_header_block.h" |
| 38 #include "net/spdy/spdy_protocol.h" | 39 #include "net/spdy/spdy_protocol.h" |
| 39 #include "net/spdy/spdy_session_pool.h" | 40 #include "net/spdy/spdy_session_pool.h" |
| 40 #include "net/spdy/spdy_stream.h" | 41 #include "net/spdy/spdy_stream.h" |
| 41 #include "net/spdy/spdy_write_queue.h" | 42 #include "net/spdy/spdy_write_queue.h" |
| 42 #include "net/ssl/ssl_config_service.h" | 43 #include "net/ssl/ssl_config_service.h" |
| 43 #include "url/gurl.h" | 44 #include "url/gurl.h" |
| 44 | 45 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // |spdy_session_key| is the host/port that this session connects to, privacy | 284 // |spdy_session_key| is the host/port that this session connects to, privacy |
| 284 // and proxy configuration settings that it's using. | 285 // and proxy configuration settings that it's using. |
| 285 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 286 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
| 286 // network events to. | 287 // network events to. |
| 287 SpdySession(const SpdySessionKey& spdy_session_key, | 288 SpdySession(const SpdySessionKey& spdy_session_key, |
| 288 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 289 const base::WeakPtr<HttpServerProperties>& http_server_properties, |
| 289 TransportSecurityState* transport_security_state, | 290 TransportSecurityState* transport_security_state, |
| 290 bool verify_domain_authentication, | 291 bool verify_domain_authentication, |
| 291 bool enable_sending_initial_data, | 292 bool enable_sending_initial_data, |
| 292 bool enable_ping_based_connection_checking, | 293 bool enable_ping_based_connection_checking, |
| 294 bool enable_priority_dependencies, |
| 293 NextProto default_protocol, | 295 NextProto default_protocol, |
| 294 size_t session_max_recv_window_size, | 296 size_t session_max_recv_window_size, |
| 295 size_t stream_max_recv_window_size, | 297 size_t stream_max_recv_window_size, |
| 296 TimeFunc time_func, | 298 TimeFunc time_func, |
| 297 ProxyDelegate* proxy_delegate, | 299 ProxyDelegate* proxy_delegate, |
| 298 NetLog* net_log); | 300 NetLog* net_log); |
| 299 | 301 |
| 300 ~SpdySession() override; | 302 ~SpdySession() override; |
| 301 | 303 |
| 302 const HostPortPair& host_port_pair() const { | 304 const HostPortPair& host_port_pair() const { |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 } | 996 } |
| 995 | 997 |
| 996 int64_t pings_in_flight() const { return pings_in_flight_; } | 998 int64_t pings_in_flight() const { return pings_in_flight_; } |
| 997 | 999 |
| 998 SpdyPingId next_ping_id() const { return next_ping_id_; } | 1000 SpdyPingId next_ping_id() const { return next_ping_id_; } |
| 999 | 1001 |
| 1000 base::TimeTicks last_activity_time() const { return last_activity_time_; } | 1002 base::TimeTicks last_activity_time() const { return last_activity_time_; } |
| 1001 | 1003 |
| 1002 bool check_ping_status_pending() const { return check_ping_status_pending_; } | 1004 bool check_ping_status_pending() const { return check_ping_status_pending_; } |
| 1003 | 1005 |
| 1004 // Set whether priority->dependency conversion is enabled | |
| 1005 // by default for all future SpdySessions. | |
| 1006 static void SetPriorityDependencyDefaultForTesting(bool enable); | |
| 1007 | |
| 1008 // Whether Do{Read,Write}Loop() is in the call stack. Useful for | 1006 // Whether Do{Read,Write}Loop() is in the call stack. Useful for |
| 1009 // making sure we don't destroy ourselves prematurely in that case. | 1007 // making sure we don't destroy ourselves prematurely in that case. |
| 1010 bool in_io_loop_; | 1008 bool in_io_loop_; |
| 1011 | 1009 |
| 1012 // The key used to identify this session. | 1010 // The key used to identify this session. |
| 1013 const SpdySessionKey spdy_session_key_; | 1011 const SpdySessionKey spdy_session_key_; |
| 1014 | 1012 |
| 1015 // Set set of SpdySessionKeys for which this session has serviced | 1013 // Set set of SpdySessionKeys for which this session has serviced |
| 1016 // requests. | 1014 // requests. |
| 1017 std::set<SpdySessionKey> pooled_aliases_; | 1015 std::set<SpdySessionKey> pooled_aliases_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1043 // the server to start pushing the stream]) or there are still network events | 1041 // the server to start pushing the stream]) or there are still network events |
| 1044 // incoming even though the consumer has already gone away (cancellation). | 1042 // incoming even though the consumer has already gone away (cancellation). |
| 1045 // | 1043 // |
| 1046 // |active_streams_| owns all its SpdyStream objects. | 1044 // |active_streams_| owns all its SpdyStream objects. |
| 1047 // | 1045 // |
| 1048 // TODO(willchan): Perhaps we should separate out cancelled streams and move | 1046 // TODO(willchan): Perhaps we should separate out cancelled streams and move |
| 1049 // them into a separate ActiveStreamMap, and not deliver network events to | 1047 // them into a separate ActiveStreamMap, and not deliver network events to |
| 1050 // them? | 1048 // them? |
| 1051 ActiveStreamMap active_streams_; | 1049 ActiveStreamMap active_streams_; |
| 1052 | 1050 |
| 1053 // Per-priority map from stream id to all active streams. This map will | |
| 1054 // contain the same set of streams as |active_streams_|. It is used for | |
| 1055 // setting dependencies to match incoming requests RequestPriority. | |
| 1056 // | |
| 1057 // |active_streams_by_priority_| does *not* own its SpdyStream objects. | |
| 1058 std::map<SpdyStreamId, SpdyStream*> | |
| 1059 active_streams_by_priority_[NUM_PRIORITIES]; | |
| 1060 | |
| 1061 UnclaimedPushedStreamContainer unclaimed_pushed_streams_; | 1051 UnclaimedPushedStreamContainer unclaimed_pushed_streams_; |
| 1062 | 1052 |
| 1063 // Set of all created streams but that have not yet sent any frames. | 1053 // Set of all created streams but that have not yet sent any frames. |
| 1064 // | 1054 // |
| 1065 // |created_streams_| owns all its SpdyStream objects. | 1055 // |created_streams_| owns all its SpdyStream objects. |
| 1066 CreatedStreamSet created_streams_; | 1056 CreatedStreamSet created_streams_; |
| 1067 | 1057 |
| 1068 // Number of pushed streams. All active streams are stored in | 1058 // Number of pushed streams. All active streams are stored in |
| 1069 // |active_streams_|, but it's better to know the number of push streams | 1059 // |active_streams_|, but it's better to know the number of push streams |
| 1070 // without traversing the whole collection. | 1060 // without traversing the whole collection. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 // get a PING response (http://crbug.com/127812). | 1213 // get a PING response (http://crbug.com/127812). |
| 1224 base::TimeDelta hung_interval_; | 1214 base::TimeDelta hung_interval_; |
| 1225 | 1215 |
| 1226 // The |proxy_delegate_| verifies that a given proxy is a trusted SPDY proxy, | 1216 // The |proxy_delegate_| verifies that a given proxy is a trusted SPDY proxy, |
| 1227 // which is allowed to push resources from origins that are different from | 1217 // which is allowed to push resources from origins that are different from |
| 1228 // those of their associated streams. May be nullptr. | 1218 // those of their associated streams. May be nullptr. |
| 1229 ProxyDelegate* proxy_delegate_; | 1219 ProxyDelegate* proxy_delegate_; |
| 1230 | 1220 |
| 1231 TimeFunc time_func_; | 1221 TimeFunc time_func_; |
| 1232 | 1222 |
| 1233 // Should priority-based dependency information be sent in stream header | 1223 const bool priority_dependencies_enabled_; |
| 1234 // frames. | 1224 Http2PriorityDependencies priority_dependency_state_; |
| 1235 bool send_priority_dependency_; | |
| 1236 | 1225 |
| 1237 // Used for posting asynchronous IO tasks. We use this even though | 1226 // Used for posting asynchronous IO tasks. We use this even though |
| 1238 // SpdySession is refcounted because we don't need to keep the SpdySession | 1227 // SpdySession is refcounted because we don't need to keep the SpdySession |
| 1239 // alive if the last reference is within a RunnableMethod. Just revoke the | 1228 // alive if the last reference is within a RunnableMethod. Just revoke the |
| 1240 // method. | 1229 // method. |
| 1241 base::WeakPtrFactory<SpdySession> weak_factory_; | 1230 base::WeakPtrFactory<SpdySession> weak_factory_; |
| 1242 }; | 1231 }; |
| 1243 | 1232 |
| 1244 } // namespace net | 1233 } // namespace net |
| 1245 | 1234 |
| 1246 #endif // NET_SPDY_SPDY_SESSION_H_ | 1235 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |