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_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "net/http/http_stream_factory_impl.h" | 10 #include "net/http/http_stream_factory_impl.h" |
11 #include "net/log/net_log.h" | 11 #include "net/log/net_log.h" |
| 12 #include "net/socket/connection_attempts.h" |
12 #include "net/socket/ssl_client_socket.h" | 13 #include "net/socket/ssl_client_socket.h" |
13 #include "net/spdy/spdy_session_key.h" | 14 #include "net/spdy/spdy_session_key.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 | 18 |
18 class ClientSocketHandle; | 19 class ClientSocketHandle; |
19 class HttpStream; | 20 class HttpStream; |
20 class SpdySession; | 21 class SpdySession; |
21 | 22 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // If this Request has a |spdy_session_key_|, remove this session from the | 54 // If this Request has a |spdy_session_key_|, remove this session from the |
54 // SpdySessionRequestMap. | 55 // SpdySessionRequestMap. |
55 void RemoveRequestFromSpdySessionRequestMap(); | 56 void RemoveRequestFromSpdySessionRequestMap(); |
56 | 57 |
57 // Called by an attached Job if it sets up a SpdySession. | 58 // Called by an attached Job if it sets up a SpdySession. |
58 void OnNewSpdySessionReady(Job* job, | 59 void OnNewSpdySessionReady(Job* job, |
59 scoped_ptr<HttpStream> stream, | 60 scoped_ptr<HttpStream> stream, |
60 const base::WeakPtr<SpdySession>& spdy_session, | 61 const base::WeakPtr<SpdySession>& spdy_session, |
61 bool direct); | 62 bool direct); |
62 | 63 |
| 64 // Called by an attached Job to record connection attempts made by the socket |
| 65 // layer for this stream request. |
| 66 void AddConnectionAttempts(const ConnectionAttempts& attempts); |
| 67 |
63 WebSocketHandshakeStreamBase::CreateHelper* | 68 WebSocketHandshakeStreamBase::CreateHelper* |
64 websocket_handshake_stream_create_helper() { | 69 websocket_handshake_stream_create_helper() { |
65 return websocket_handshake_stream_create_helper_; | 70 return websocket_handshake_stream_create_helper_; |
66 } | 71 } |
67 | 72 |
68 // HttpStreamRequest::Delegate methods which we implement. Note we don't | 73 // HttpStreamRequest::Delegate methods which we implement. Note we don't |
69 // actually subclass HttpStreamRequest::Delegate. | 74 // actually subclass HttpStreamRequest::Delegate. |
70 | 75 |
71 void OnStreamReady(Job* job, | 76 void OnStreamReady(Job* job, |
72 const SSLConfig& used_ssl_config, | 77 const SSLConfig& used_ssl_config, |
(...skipping 24 matching lines...) Expand all Loading... |
97 HttpStream* stream); | 102 HttpStream* stream); |
98 | 103 |
99 // HttpStreamRequest methods. | 104 // HttpStreamRequest methods. |
100 | 105 |
101 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials) override; | 106 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials) override; |
102 void SetPriority(RequestPriority priority) override; | 107 void SetPriority(RequestPriority priority) override; |
103 LoadState GetLoadState() const override; | 108 LoadState GetLoadState() const override; |
104 bool was_npn_negotiated() const override; | 109 bool was_npn_negotiated() const override; |
105 NextProto protocol_negotiated() const override; | 110 NextProto protocol_negotiated() const override; |
106 bool using_spdy() const override; | 111 bool using_spdy() const override; |
| 112 const ConnectionAttempts& connection_attempts() const override; |
107 | 113 |
108 private: | 114 private: |
109 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound" | 115 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound" |
110 // to the request. | 116 // to the request. |
111 void OrphanJobsExcept(Job* job); | 117 void OrphanJobsExcept(Job* job); |
112 | 118 |
113 // Used to orphan all jobs in |jobs_|. | 119 // Used to orphan all jobs in |jobs_|. |
114 void OrphanJobs(); | 120 void OrphanJobs(); |
115 | 121 |
116 // Called when a Job succeeds. | 122 // Called when a Job succeeds. |
117 void OnJobSucceeded(Job* job); | 123 void OnJobSucceeded(Job* job); |
118 | 124 |
119 const GURL url_; | 125 const GURL url_; |
120 HttpStreamFactoryImpl* const factory_; | 126 HttpStreamFactoryImpl* const factory_; |
121 WebSocketHandshakeStreamBase::CreateHelper* const | 127 WebSocketHandshakeStreamBase::CreateHelper* const |
122 websocket_handshake_stream_create_helper_; | 128 websocket_handshake_stream_create_helper_; |
123 HttpStreamRequest::Delegate* const delegate_; | 129 HttpStreamRequest::Delegate* const delegate_; |
124 const BoundNetLog net_log_; | 130 const BoundNetLog net_log_; |
125 | 131 |
126 // At the point where Job is irrevocably tied to the Request, we set this. | 132 // At the point where Job is irrevocably tied to the Request, we set this. |
127 scoped_ptr<Job> bound_job_; | 133 scoped_ptr<Job> bound_job_; |
128 std::set<HttpStreamFactoryImpl::Job*> jobs_; | 134 std::set<HttpStreamFactoryImpl::Job*> jobs_; |
129 scoped_ptr<const SpdySessionKey> spdy_session_key_; | 135 scoped_ptr<const SpdySessionKey> spdy_session_key_; |
130 | 136 |
131 bool completed_; | 137 bool completed_; |
132 bool was_npn_negotiated_; | 138 bool was_npn_negotiated_; |
133 // Protocol negotiated with the server. | 139 // Protocol negotiated with the server. |
134 NextProto protocol_negotiated_; | 140 NextProto protocol_negotiated_; |
135 bool using_spdy_; | 141 bool using_spdy_; |
| 142 ConnectionAttempts connection_attempts_; |
136 | 143 |
137 DISALLOW_COPY_AND_ASSIGN(Request); | 144 DISALLOW_COPY_AND_ASSIGN(Request); |
138 }; | 145 }; |
139 | 146 |
140 } // namespace net | 147 } // namespace net |
141 | 148 |
142 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 149 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
OLD | NEW |