| 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/base/net_log.h" | 10 #include "net/base/net_log.h" |
| (...skipping 42 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 | 53 // If this Request has a |spdy_session_key_|, remove this session from the |
| 54 // SpdySessionRequestMap. | 54 // SpdySessionRequestMap. |
| 55 void RemoveRequestFromSpdySessionRequestMap(); | 55 void RemoveRequestFromSpdySessionRequestMap(); |
| 56 | 56 |
| 57 // Called by an attached Job if it sets up a SpdySession. | 57 // Called by an attached Job if it sets up a SpdySession. |
| 58 void OnNewSpdySessionReady(Job* job, | 58 void OnNewSpdySessionReady(Job* job, |
| 59 scoped_ptr<HttpStream> stream, | 59 scoped_ptr<HttpStream> stream, |
| 60 const base::WeakPtr<SpdySession>& spdy_session, | 60 const base::WeakPtr<SpdySession>& spdy_session, |
| 61 bool direct); | 61 bool direct); |
| 62 | 62 |
| 63 // Called by an attached Job to record connection attempts made by the socket |
| 64 // layer for this stream request. |
| 65 void AddConnectionAttempts( |
| 66 const ClientSocketHandle::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 ClientSocketHandle::ConnectionAttempts& connection_attempts() |
| 113 const override; |
| 107 | 114 |
| 108 private: | 115 private: |
| 109 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound" | 116 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound" |
| 110 // to the request. | 117 // to the request. |
| 111 void OrphanJobsExcept(Job* job); | 118 void OrphanJobsExcept(Job* job); |
| 112 | 119 |
| 113 // Used to orphan all jobs in |jobs_|. | 120 // Used to orphan all jobs in |jobs_|. |
| 114 void OrphanJobs(); | 121 void OrphanJobs(); |
| 115 | 122 |
| 116 // Called when a Job succeeds. | 123 // Called when a Job succeeds. |
| 117 void OnJobSucceeded(Job* job); | 124 void OnJobSucceeded(Job* job); |
| 118 | 125 |
| 119 const GURL url_; | 126 const GURL url_; |
| 120 HttpStreamFactoryImpl* const factory_; | 127 HttpStreamFactoryImpl* const factory_; |
| 121 WebSocketHandshakeStreamBase::CreateHelper* const | 128 WebSocketHandshakeStreamBase::CreateHelper* const |
| 122 websocket_handshake_stream_create_helper_; | 129 websocket_handshake_stream_create_helper_; |
| 123 HttpStreamRequest::Delegate* const delegate_; | 130 HttpStreamRequest::Delegate* const delegate_; |
| 124 const BoundNetLog net_log_; | 131 const BoundNetLog net_log_; |
| 125 | 132 |
| 126 // At the point where Job is irrevocably tied to the Request, we set this. | 133 // At the point where Job is irrevocably tied to the Request, we set this. |
| 127 scoped_ptr<Job> bound_job_; | 134 scoped_ptr<Job> bound_job_; |
| 128 std::set<HttpStreamFactoryImpl::Job*> jobs_; | 135 std::set<HttpStreamFactoryImpl::Job*> jobs_; |
| 129 scoped_ptr<const SpdySessionKey> spdy_session_key_; | 136 scoped_ptr<const SpdySessionKey> spdy_session_key_; |
| 130 | 137 |
| 131 bool completed_; | 138 bool completed_; |
| 132 bool was_npn_negotiated_; | 139 bool was_npn_negotiated_; |
| 133 // Protocol negotiated with the server. | 140 // Protocol negotiated with the server. |
| 134 NextProto protocol_negotiated_; | 141 NextProto protocol_negotiated_; |
| 135 bool using_spdy_; | 142 bool using_spdy_; |
| 143 ClientSocketHandle::ConnectionAttempts connection_attempts_; |
| 136 | 144 |
| 137 DISALLOW_COPY_AND_ASSIGN(Request); | 145 DISALLOW_COPY_AND_ASSIGN(Request); |
| 138 }; | 146 }; |
| 139 | 147 |
| 140 } // namespace net | 148 } // namespace net |
| 141 | 149 |
| 142 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 150 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
| OLD | NEW |