Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 virtual void SetPriority(RequestPriority priority) = 0; | 43 virtual void SetPriority(RequestPriority priority) = 0; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Request will notify |job_controller| when it's destructed. | 46 // Request will notify |job_controller| when it's destructed. |
| 47 // Thus |job_controller| is valid for the lifetime of the |this| Request. | 47 // Thus |job_controller| is valid for the lifetime of the |this| Request. |
| 48 Request(const GURL& url, | 48 Request(const GURL& url, |
| 49 Helper* helper, | 49 Helper* helper, |
| 50 HttpStreamRequest::Delegate* delegate, | 50 HttpStreamRequest::Delegate* delegate, |
| 51 WebSocketHandshakeStreamBase::CreateHelper* | 51 WebSocketHandshakeStreamBase::CreateHelper* |
| 52 websocket_handshake_stream_create_helper, | 52 websocket_handshake_stream_create_helper, |
| 53 const NetLogWithSource& net_log, | 53 const NetLogWithSource* net_log, |
| 54 StreamType stream_type); | 54 StreamType stream_type); |
| 55 | 55 |
| 56 ~Request() override; | 56 ~Request() override; |
| 57 | 57 |
| 58 // The GURL from the HttpRequestInfo the started the Request. | 58 // The GURL from the HttpRequestInfo the started the Request. |
| 59 const GURL& url() const { return url_; } | 59 const GURL& url() const { return url_; } |
| 60 | 60 |
| 61 const NetLogWithSource& net_log() const { return net_log_; } | |
| 62 | |
| 63 // Called when the |helper_| determines the appropriate |spdy_session_key| | 61 // Called when the |helper_| determines the appropriate |spdy_session_key| |
| 64 // for the Request. Note that this does not mean that SPDY is necessarily | 62 // for the Request. Note that this does not mean that SPDY is necessarily |
| 65 // supported for this SpdySessionKey, since we may need to wait for NPN to | 63 // supported for this SpdySessionKey, since we may need to wait for NPN to |
| 66 // complete before knowing if SPDY is available. | 64 // complete before knowing if SPDY is available. |
| 67 void SetSpdySessionKey(const SpdySessionKey& spdy_session_key); | 65 void SetSpdySessionKey(const SpdySessionKey& spdy_session_key); |
| 68 bool HasSpdySessionKey() const; | 66 bool HasSpdySessionKey() const; |
| 69 | 67 |
| 70 // Marks completion of the request. Must be called before OnStreamReady(). | 68 // Marks completion of the request. Must be called before OnStreamReady(). |
| 71 void Complete(bool was_alpn_negotiated, | 69 void Complete(bool was_alpn_negotiated, |
| 72 NextProto negotiated_protocol, | 70 NextProto negotiated_protocol, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 | 126 |
| 129 private: | 127 private: |
| 130 const GURL url_; | 128 const GURL url_; |
| 131 | 129 |
| 132 // Unowned. The helper must outlive this request. | 130 // Unowned. The helper must outlive this request. |
| 133 Helper* helper_; | 131 Helper* helper_; |
| 134 | 132 |
| 135 WebSocketHandshakeStreamBase::CreateHelper* const | 133 WebSocketHandshakeStreamBase::CreateHelper* const |
| 136 websocket_handshake_stream_create_helper_; | 134 websocket_handshake_stream_create_helper_; |
| 137 HttpStreamRequest::Delegate* const delegate_; | 135 HttpStreamRequest::Delegate* const delegate_; |
| 138 const NetLogWithSource net_log_; | 136 |
| 137 // Initialized to point to the NetLogWithSource of JobController. Valid for | |
| 138 // the lifetime of |this|. | |
| 139 const NetLogWithSource* net_log_; | |
|
eroman
2017/01/25 19:55:27
NetLogWithSource supports copy-construction do thi
xunjieli
2017/01/25 21:41:49
Done.
| |
| 139 | 140 |
| 140 std::unique_ptr<const SpdySessionKey> spdy_session_key_; | 141 std::unique_ptr<const SpdySessionKey> spdy_session_key_; |
| 141 | 142 |
| 142 bool completed_; | 143 bool completed_; |
| 143 bool was_alpn_negotiated_; | 144 bool was_alpn_negotiated_; |
| 144 // Protocol negotiated with the server. | 145 // Protocol negotiated with the server. |
| 145 NextProto negotiated_protocol_; | 146 NextProto negotiated_protocol_; |
| 146 bool using_spdy_; | 147 bool using_spdy_; |
| 147 ConnectionAttempts connection_attempts_; | 148 ConnectionAttempts connection_attempts_; |
| 148 | 149 |
| 149 const HttpStreamRequest::StreamType stream_type_; | 150 const HttpStreamRequest::StreamType stream_type_; |
| 150 DISALLOW_COPY_AND_ASSIGN(Request); | 151 DISALLOW_COPY_AND_ASSIGN(Request); |
| 151 }; | 152 }; |
| 152 | 153 |
| 153 } // namespace net | 154 } // namespace net |
| 154 | 155 |
| 155 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 156 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
| OLD | NEW |